You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the recent implementation of SHA3, a question of what API to adhere to was best, as the current hashing functions BLAKE2b and SHA2 have different ones.
We support the three, SHA256, SHA384 and SHA512, variants of the SHA2 algorithm. These variants differ in both implementation as well as output size. Thus, the API is currently structured as one struct per variant and one Digest struct per variant. The different Digest struct then hardcore the only output-size given by each of the SHA2 variants.
BLAKE2b on the other hand has one struct and one Digest struct. Digest cannot hardcode the output sizes, because BLAKE2b supports 1..=64. Thus, the single Digest can hold a hash of length in that range. Further, the single BLAKE2b struct takes in the ::new() the output size parameter.
SHA3 is different from SHA2. While there are only four variants standardized by NIST (224, 256, 384 and 512), these all use the same implementation, with only an internal const as difference. This means one SHA3 struct could represent all variants, take the variant as parameter in ::new() (like BLAKE2b) or const argument. Then a single Digest struct like BLAKE2b, that can be either 224, 256, 384 or 512 bits in length.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In the recent implementation of SHA3, a question of what API to adhere to was best, as the current hashing functions BLAKE2b and SHA2 have different ones.
We support the three, SHA256, SHA384 and SHA512, variants of the SHA2 algorithm. These variants differ in both implementation as well as output size. Thus, the API is currently structured as one struct per variant and one
Digest
struct per variant. The differentDigest
struct then hardcore the only output-size given by each of the SHA2 variants.BLAKE2b on the other hand has one struct and one
Digest
struct.Digest
cannot hardcode the output sizes, because BLAKE2b supports 1..=64. Thus, the singleDigest
can hold a hash of length in that range. Further, the single BLAKE2b struct takes in the::new()
the output size parameter.SHA3 is different from SHA2. While there are only four variants standardized by NIST (224, 256, 384 and 512), these all use the same implementation, with only an internal const as difference. This means one SHA3 struct could represent all variants, take the variant as parameter in
::new()
(like BLAKE2b) or const argument. Then a singleDigest
struct like BLAKE2b, that can be either 224, 256, 384 or 512 bits in length.Beta Was this translation helpful? Give feedback.
All reactions