Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hasher doesn't implement digest::crypto_common::BlockSizeUser #224

Closed
jbis9051 opened this issue Jan 23, 2022 · 0 comments · Fixed by #225
Closed

Hasher doesn't implement digest::crypto_common::BlockSizeUser #224

jbis9051 opened this issue Jan 23, 2022 · 0 comments · Fixed by #225

Comments

@jbis9051
Copy link
Contributor

use hmac::{Mac, SimpleHmac};
use blake3::{Hasher};

fn main() {
   let mut x = SimpleHmac::<Hasher>::new_from_slice(b"test");
   x.update(b"test2");
   println!("{:?}", x.finalize().into_bytes());
}
error[E0599]: the function or associated item `new_from_slice` exists for struct `SimpleHmac<blake3::Hasher>`, but its trait bounds were not satisfied
  --> src/main.rs:5:38
   |
5  |    let mut x = SimpleHmac::<Hasher>::new_from_slice(b"test").unwrap();
   |                                      ^^^^^^^^^^^^^^ function or associated item cannot be called on `SimpleHmac<blake3::Hasher>` due to unsatisfied trait bounds
   |
  ::: /Users/joshuabrown3/.cargo/registry/src/github.com-1ecc6299db9ec823/hmac-0.12.0/src/simple.rs:14:1
   |
14 | pub struct SimpleHmac<D: Digest + BlockSizeUser> {
   | ------------------------------------------------
   | |
   | doesn't satisfy `SimpleHmac<blake3::Hasher>: FixedOutput`
   | doesn't satisfy `SimpleHmac<blake3::Hasher>: KeyInit`
   | doesn't satisfy `SimpleHmac<blake3::Hasher>: MacMarker`
   | doesn't satisfy `SimpleHmac<blake3::Hasher>: Mac`
   | doesn't satisfy `SimpleHmac<blake3::Hasher>: Sized`
   | doesn't satisfy `SimpleHmac<blake3::Hasher>: Update`
   |
   = note: the following trait bounds were not satisfied:
           `SimpleHmac<blake3::Hasher>: Sized`
           which is required by `SimpleHmac<blake3::Hasher>: Mac`
           `SimpleHmac<blake3::Hasher>: KeyInit`
           which is required by `SimpleHmac<blake3::Hasher>: Mac`
           `SimpleHmac<blake3::Hasher>: Update`
           which is required by `SimpleHmac<blake3::Hasher>: Mac`
           `SimpleHmac<blake3::Hasher>: FixedOutput`
           which is required by `SimpleHmac<blake3::Hasher>: Mac`
           `SimpleHmac<blake3::Hasher>: MacMarker`
           which is required by `SimpleHmac<blake3::Hasher>: Mac`
           `&SimpleHmac<blake3::Hasher>: KeyInit`
           which is required by `&SimpleHmac<blake3::Hasher>: Mac`
           `&SimpleHmac<blake3::Hasher>: Update`
           which is required by `&SimpleHmac<blake3::Hasher>: Mac`
           `&SimpleHmac<blake3::Hasher>: FixedOutput`
           which is required by `&SimpleHmac<blake3::Hasher>: Mac`
           `&SimpleHmac<blake3::Hasher>: MacMarker`
           which is required by `&SimpleHmac<blake3::Hasher>: Mac`
           `&mut SimpleHmac<blake3::Hasher>: KeyInit`
           which is required by `&mut SimpleHmac<blake3::Hasher>: Mac`
           `&mut SimpleHmac<blake3::Hasher>: Update`
           which is required by `&mut SimpleHmac<blake3::Hasher>: Mac`
           `&mut SimpleHmac<blake3::Hasher>: FixedOutput`
           which is required by `&mut SimpleHmac<blake3::Hasher>: Mac`
           `&mut SimpleHmac<blake3::Hasher>: MacMarker`
           which is required by `&mut SimpleHmac<blake3::Hasher>: Mac`


error[E0277]: the trait bound `blake3::Hasher: BlockSizeUser` is not satisfied
  --> src/main.rs:5:16
   |
5  |    let mut x = SimpleHmac::<Hasher>::new_from_slice(b"test").unwrap();
   |                ^^^^^^^^^^^^^^^^^^^^ the trait `BlockSizeUser` is not implemented for `blake3::Hasher`
   |
note: required by a bound in `SimpleHmac`
  --> /Users/joshuabrown3/.cargo/registry/src/github.com-1ecc6299db9ec823/hmac-0.12.0/src/simple.rs:14:35
   |
14 | pub struct SimpleHmac<D: Digest + BlockSizeUser> {
   |                                   ^^^^^^^^^^^^^ required by this bound in `SimpleHmac`

This is with

[dependencies]
hmac = "0.12.0"
blake3 = { version = "1.3.0", features = ["traits-preview"] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant