Class: SHA3::Digest
- Inherits:
-
Digest::Class
- Object
- Digest::Class
- SHA3::Digest
- Defined in:
- lib/sha3/doc.rb
Overview
SHA3::Digest class provides a four sub-classes for the available hash bit lengths (types). You can instantiate a new instance of Digest sub-class for a given type using the following sub-classes:
SHA3::Digest::SHA224([data])
SHA3::Digest::SHA256([data])
SHA3::Digest::SHA384([data])
SHA3::Digest::SHA512([data])
The [data] parameter is optional.
A sub-class of (MRI Ruby based) Digest::Class, it implements SHA3 (Keccak) digest algorithm.
Class Method Summary collapse
-
.digest(type, data) ⇒ String
Returns computed hash value for given hash type, and data in bytes.
-
.hexdigest(type, data) ⇒ String
Returns computed hash value for given hash type, and data in hex (string).
Instance Method Summary collapse
-
#block_length ⇒ Number
Returns digest block length in bytes.
-
#initialize(type, data) ⇒ Digest
constructor
Creates a Digest instance based on given hash bit length (type).
-
#length ⇒ Number
Returns message digest length in bytes.
-
#name ⇒ String
Returns name of initialized digest.
-
#reset ⇒ Digest
Resets the Digest object to initial state, abandoning computed data.
-
#update(data) ⇒ Digest
(also: #<<)
Updates, and recalculates Message Digest (state) with given data.
Constructor Details
#initialize(type, data) ⇒ Digest
Creates a Digest instance based on given hash bit length (type).
35 36 37 |
# File 'lib/sha3/doc.rb', line 35 def initialize(type, data) # See function: c_digest_init(...) in ext/sha3/_digest.c end |
Class Method Details
.digest(type, data) ⇒ String
Returns computed hash value for given hash type, and data in bytes.
116 |
# File 'lib/sha3/doc.rb', line 116 def self.digest(type, data); end |
.hexdigest(type, data) ⇒ String
Returns computed hash value for given hash type, and data in hex (string).
104 |
# File 'lib/sha3/doc.rb', line 104 def self.hexdigest(type, data); end |
Instance Method Details
#block_length ⇒ Number
Returns digest block length in bytes.
83 84 85 |
# File 'lib/sha3/doc.rb', line 83 def block_length # See function: c_digest_block_length(...) in ext/sha3/_digest.c end |
#length ⇒ Number
Returns message digest length in bytes.
72 73 74 |
# File 'lib/sha3/doc.rb', line 72 def length # See function: c_digest_length(...) in ext/sha3/_digest.c end |
#name ⇒ String
Returns name of initialized digest
90 91 92 |
# File 'lib/sha3/doc.rb', line 90 def name # See function: c_digest_name(...) in ext/sha3/_digest.c end |
#reset ⇒ Digest
Resets the Digest object to initial state, abandoning computed data.
61 62 63 |
# File 'lib/sha3/doc.rb', line 61 def reset # See function: c_digest_reset(...) in ext/sha3/_digest.c end |
#update(data) ⇒ Digest Also known as: <<
Updates, and recalculates Message Digest (state) with given data. If a message digest is to be computed from several subsequent sources, then each may be passed individually to the Digest instance.
51 52 53 |
# File 'lib/sha3/doc.rb', line 51 def update(data) # See function: c_digest_update(...) in ext/sha3/_digest.c end |