-
Notifications
You must be signed in to change notification settings - Fork 357
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
How to use BLAKE3 with HKDF? #223
Comments
The For what it's worth, BLAKE3 provides a |
@oconnor663 Thanks for the suggestion, unfortunately the spec calls for HMAC so I can't use derive_key. Possibly a different issue, but I'm having trouble using SimpleHmac as well 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");
| ^^^^^^^^^^^^^^ function or associated item cannot be called on `SimpleHmac<blake3::Hasher>` due to unsatisfied trait bounds
|
::: /Users/jbis/.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` This is with [dependencies]
hmac = "0.12.0"
blake3 = { version = "1.3.0", features = ["traits-preview"] } |
cc @newpavlov |
Closed in favor of #224. HKDF uses Hmac. BLAKE3 isn't compatible with Hmac. However, it should be compatible with SimpleHmac (see the other issue). Once it works for SimpleHmac and RustCrypto/KDFs#56 is merged, blake3 will work with HKDF. |
I attempted to use the following from https://github.com/RustCrypto/KDFs/
however I am getting
The text was updated successfully, but these errors were encountered: