Open threema-theo opened 3 months ago
This introduces unkeyed hashing for blake2 as specified in Section 2.5 of RFC 7693 states the following:
The second (little-endian) byte of the parameter block, "kk", specifies the key size in bytes. Set kk = 00 for unkeyed hashing.
I propose to make the key an Option<&[u8]>:
Option<&[u8]>
pub fn new_with_salt_and_personal( key: Option<&[u8]>, salt: &[u8], persona: &[u8], ) -> Result<Self, InvalidLength>
By making the key an Option<&[u8]> - rather than opting for the unkeyed usage in case of an empty key - we make the unkeyed usage explicit and avoid inadvertent usages.
key
This closes #482. See also #509.
This introduces unkeyed hashing for blake2 as specified in Section 2.5 of RFC 7693 states the following:
I propose to make the key an
Option<&[u8]>
:By making the key an
Option<&[u8]>
- rather than opting for the unkeyed usage in case of an emptykey
- we make the unkeyed usage explicit and avoid inadvertent usages.This closes #482. See also #509.