RustCrypto / hashes

Collection of cryptographic hash functions written in pure Rust
1.82k stars 247 forks source link

sha3: Incorrect type alias for Xof readers? #426

Closed andrewwhitehead closed 1 year ago

andrewwhitehead commented 1 year ago

In sha3 1.10.5 the Shake256Reader type alias expands to XofReaderCoreWrapper<Shake256Core>, but this produces the following type error when used:

the trait bound `Shake256Core: XofReaderCore` is not satisfied
the following other types implement trait `XofReaderCore`:
  CShake128ReaderCore
  CShake256ReaderCore
  Shake128ReaderCore
  Shake256ReaderCore

In the impl_shake macro this is defined by:

pub type $reader_full = XofReaderCoreWrapper<$name>;

Which I suspect should be:

pub type $reader_full = XofReaderCoreWrapper<$reader>;

As a workaround, I am just redefining the type alias as such:

type Shake256Reader = sha3::digest::core_api::XofReaderCoreWrapper<sha3::Shake256ReaderCore>;
newpavlov commented 1 year ago

You are correct, there is a mistake in the impl macro. I will fix it right away.

andrewwhitehead commented 1 year ago

Thanks!