Class: ZATCA::Hashing
- Inherits:
-
Object
- Object
- ZATCA::Hashing
- Defined in:
- lib/zatca/hashing.rb
Class Method Summary collapse
-
.generate_hashes(content) ⇒ Object
Returns the content as: - hash - SHA256 digest (bytes) - hexdigest - SHA256 digest (hex) - base64 - SHA256 digest (bytes) then Base64 encoded - hexdigest_base64 - SHA256 digest (hex) then Base64 encoded.
Class Method Details
.generate_hashes(content) ⇒ Object
Returns the content as:
-
hash - SHA256 digest (bytes)
-
hexdigest - SHA256 digest (hex)
-
base64 - SHA256 digest (bytes) then Base64 encoded
-
hexdigest_base64 - SHA256 digest (hex) then Base64 encoded
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/zatca/hashing.rb', line 7 def self.generate_hashes(content) sha256 = Digest::SHA256.digest(content) sha256_hex = Digest::SHA256.hexdigest(content) { base64: Base64.strict_encode64(sha256), hexdigest_base64: Base64.strict_encode64(sha256_hex), hexdigest: sha256_hex, hash: sha256 } end |