`digest` crate README example has the wrong return type?
juliusl opened this issue · 1 comments
juliusl commented
The first example in the README has this,
Now you can write the following code:
use sha2::{Sha256, Digest}; let mut hasher = Sha256::new(); let data = b"Hello world!"; hasher.update(data); // `input` can be called repeatedly and is generic over `AsRef<[u8]>` hasher.update("String data"); // Note that calling `finalize()` consumes hasher let hash = hasher.finalize(); println!("Result: {:x}", hash);In this example hash has type GenericArray<u8, U64>, which is a generic alternative to [u8; 64].
Shouldn't it be GenericArray<u8, U32>
?
From https://docs.rs/sha2/0.10.8/sha2/type.Sha256.html:
pub type Sha256 = CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, U32, OidSha256>>;
tarcieri commented
Yes, looks like the digest was changed from Blake2b
to Sha256
, but that section was not updated accordingly