Skip to main content

blake2b_long

Function blake2b_long 

Source
pub fn blake2b_long(out: &mut [u8], input: &[u8]) -> Result<(), Error>
Expand description

blake2b_long(out, outlen, in, inlen): Argon2’s variable-length extension.

The output length is out.len().

For outlen <= 64 it is init(outlen), update(LE32(outlen)), update(in), final.

For outlen > 64 it produces a 64-byte out_buffer, emits the first 32 bytes, then while toproduce > 64 (strictly greater) rehashes 64 -> 64 and emits 32 each time, and finally emits a toproduce-byte digest of the last 64-byte buffer. For outlen = 1024 that is 32 + 29*32 + 64 = 1024. Here toproduce is just the length of the not-yet-written tail of out.

§Errors

Error::IncorrectParameter if out is empty (the C’s blake2b_init rejects a zero digest length) or longer than crate::params::MAX_OUTLEN (the C’s outlen > UINT32_MAX).