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().
A digest gives back the hash of its input, or it raises. It never gives back
a hash of something else. Constructing one raises when OpenSSL cannot give it
a context; append() and final() raise when OpenSSL could not do what was
asked of them.
Constructors¶
md5¶
Use the MD5 algorithm to calculate the hash.
Returns¶
- Digest ref^ ?
ripemd160¶
Use the RIPEMD160 algorithm to calculate the hash.
Returns¶
- Digest ref^ ?
sha1¶
Use the SHA1 algorithm to calculate the hash.
Returns¶
- Digest ref^ ?
sha224¶
Use the SHA224 algorithm to calculate the hash.
Returns¶
- Digest ref^ ?
sha256¶
Use the SHA256 algorithm to calculate the hash.
Returns¶
- Digest ref^ ?
sha384¶
Use the SHA384 algorithm to calculate the hash.
Returns¶
- Digest ref^ ?
sha512¶
Use the SHA512 algorithm to calculate the hash.
Returns¶
- Digest ref^ ?
shake128¶
Use the SHAKE128 algorithm to calculate the hash.
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, the default size is always used.
Parameters¶
- size': USize val = 16
Returns¶
- Digest ref^ ?
shake256¶
Use the SHAKE256 algorithm to calculate the hash.
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, the default size is always used.
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 digest of the strings passed to the append() method. A second call returns the hash the first one made.
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