Digest¶
Produces a hash from the chunks of input. Feed the input with append() and
produce a final hash from the concatenation of the input with final().
append() accumulates input; final() returns the hash of the
concatenation, or raises. It never returns a hash of anything other than what
was appended. Construction raises when OpenSSL fails to allocate a context;
append() and final() raise when OpenSSL reports failure.
Constructors¶
md5¶
16-byte (128-bit) hash.
Returns¶
- Digest ref^ ?
ripemd160¶
20-byte (160-bit) hash.
Returns¶
- Digest ref^ ?
sha1¶
20-byte (160-bit) hash.
Returns¶
- Digest ref^ ?
sha224¶
28-byte (224-bit) hash.
Returns¶
- Digest ref^ ?
sha256¶
32-byte (256-bit) hash.
Returns¶
- Digest ref^ ?
sha384¶
48-byte (384-bit) hash.
Returns¶
- Digest ref^ ?
sha512¶
64-byte (512-bit) hash.
Returns¶
- Digest ref^ ?
shake128¶
SHAKE128 is an extendable output function (XOF) that can produce
variable-length output. The size' parameter controls the output length
in bytes (default: 16). Variable-length output requires OpenSSL 3.0.x or
OpenSSL 4.0.x; on OpenSSL 1.1.x, only the default size is accepted.
Parameters¶
- size': USize val = 16
Returns¶
- Digest ref^ ?
shake256¶
SHAKE256 is an extendable output function (XOF) that can produce
variable-length output. The size' parameter controls the output length
in bytes (default: 32). Variable-length output requires OpenSSL 3.0.x or
OpenSSL 4.0.x; on OpenSSL 1.1.x, only the default size is accepted.
Parameters¶
- size': USize val = 32
Returns¶
- Digest ref^ ?
Public Functions¶
append¶
Update the digest with input.
Raises an error when final() has already been called, and when OpenSSL
could not take the input.
Parameters¶
- input: ByteSeq
Returns¶
- None val ?
final¶
Return the hash of the input passed to append(). A second call returns
the hash the first one produced.
Raises an error when OpenSSL could not produce the hash. A digest that raises here has no hash to give, and raises from every later call.
Returns¶
digest_size¶
Return the size of the message digest in bytes.
Returns¶
- USize val