pub fn crypto_generichash(
output: &mut [u8],
input: &[u8],
key: Option<&[u8]>,
) -> Result<(), Error>Expand description
Computes a hash from input and key, copying the result into output.
| Parameter | Typical length | Recommended minimum | Accepted lengths |
|---|---|---|---|
output | CRYPTO_GENERICHASH_BYTES | CRYPTO_GENERICHASH_BYTES_MIN | 1 to CRYPTO_GENERICHASH_BYTES_MAX |
key | CRYPTO_GENERICHASH_KEYBYTES | CRYPTO_GENERICHASH_KEYBYTES_MIN | 0 to CRYPTO_GENERICHASH_KEYBYTES_MAX |
As in libsodium, the *_MIN constants are recommendations rather than
limits, and an empty key (Some(&[])) computes the same unkeyed hash as
None.
Compatible with libsodium’s crypto_generichash.
§Errors
Returns an error if the output or key length is outside the accepted range.