Upgrade sha2 to 0.9.3 (#14746)

This commit is contained in:
sakridge
2021-01-22 22:25:22 -08:00
committed by GitHub
parent bf1943e489
commit 191193289f
10 changed files with 136 additions and 40 deletions

View File

@@ -12,12 +12,12 @@ pub struct Hasher {
impl Hasher {
pub fn hash(&mut self, val: &[u8]) {
self.hasher.input(val);
self.hasher.update(val);
}
pub fn result(self) -> Hash {
// At the time of this writing, the sha2 library is stuck on an old version
// of generic_array (0.9.0). Decouple ourselves with a clone to our version.
Hash(<[u8; HASH_BYTES]>::try_from(self.hasher.result().as_slice()).unwrap())
Hash(<[u8; HASH_BYTES]>::try_from(self.hasher.finalize().as_slice()).unwrap())
}
}