RustCrypto / hashes

Collection of cryptographic hash functions written in pure Rust
1.75k stars 238 forks source link

sha: make compress consume blocks #579

Closed baloo closed 1 month ago

baloo commented 1 month ago

To align with the semantics of block_buffer::BlockBuffer::digest_blocks signature which works with &[Block] and not &[[u8; N]].

newpavlov commented 1 month ago

We intentionally use byte arrays in compression functions for two reasons:

The compression functions are usually fixed-sized, so I don't think it's worth to expose them to types introduced for dealing with genericity.

baloo commented 1 month ago
  • To prepare ground for future migration to const generics (plus, it's useful for hybrid-array as well).

Just to be clear, this was post hybrid-array migration. Block is an alias for hybrid_array::Array already.