Beryl::Crypto::V1::BlockHashFunction
The shared shape of MD5, SHA-1 and SHA-2: the message is cut into fixed-size blocks, each block is mixed into a running state, and the last block carries padding and the message length (the Merkle–Damgård construction of FIPS 180-4 §5 and RFC 1321 §3).
Each hash function supplies its block size, its compression function and
the layout of its length field and digest (as private methods); this class
supplies buffering, padding, and the ::Digest streaming interface
(update, final, reset, hexfinal).
Constants
The largest block of any hash in this shard, in bytes (SHA-512).
The largest digest of any hash in this shard, in bytes (SHA-512).
Every length field in this family counts bits in at least 64 bits, so a message may hold at most 2^61 - 1 bytes.
Constructors
Instance methods
Mixes list_of_blocks, whose size is a whole number of blocks, into the running state.
Takes over the running state of source, and nothing else.
Makes this instance continue from the exact point source has reached, without allocating. Both must be the same hash function.
Writes the message length in bits into length_field.
Returns the number of bytes at the end of the last block that hold the message length.