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
use blake2::{Blake2b,Digest};letmut hasher = Blake2b::new();let data = b"Hello world!";
hasher.input(data);// `input` can be called repeatedly and is generic over `AsRef<[u8]>`
hasher.input("String data");// Note that calling `finalize()` consumes hasherlet hash = hasher.finalize();println!("Result: {:x}", hash);
However, Digest values do not have an input() method; the correct name of the method is update(), and so the code above (after adding a fn main()) will not compile. Even after that's fixed, trying to compile the code still fails with the following error:
error[E0283]: type annotations needed for `CoreWrapper<CtVariableCoreWrapper<Blake2bVarCore, OutSize>>`
--> src/main.rs:4:22
|
4 | let mut hasher = Blake2b::new();
| ---------- ^^^^^^^ cannot infer type for type parameter `OutSize`
| |
| consider giving `hasher` the explicit type `CoreWrapper<CtVariableCoreWrapper<_, OutSize>>`, where the type parameter `OutSize` is specified
|
= note: cannot satisfy `_: ArrayLength<u8>`
= note: required because of the requirements on the impl of `BlockSizeUser` for `CtVariableCoreWrapper<Blake2bVarCore, _>`
For more information about this error, try `rustc --explain E0283`.
error: could not compile `digest-example` due to previous error
The text was updated successfully, but these errors were encountered:
The README for the
digest
crate currently contains the following example:However,
Digest
values do not have aninput()
method; the correct name of the method isupdate()
, and so the code above (after adding afn main()
) will not compile. Even after that's fixed, trying to compile the code still fails with the following error:The text was updated successfully, but these errors were encountered: