pub fn blake2s<const N: usize>(key: &[u8], content: &[u8]) -> [u8; N]
Expand description
blake2s
performs a Blake2s hash calculation with immediate result.
N
: size of resulting digest, must be larger than 0 and at most 32 bytes.key
: an optional key (for purpose of keyed-hash) of at most 32 bytes.content
: the content of which to produce the digest, of any length.
Returns the resulting digest, an array of size N
.
blake2s
does not expose the used context-struct. Given that stack-allocation takes minimal
overhead and firmware’s blake2s
function is self-contained, the provided context is always
(re)initialized and in the end finalized.
§Panics
In case of incorrect use, such as N too big, key length too big, etc.