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

@@ -14,7 +14,7 @@ bv = { version = "0.11.1", features = ["serde"] }
log = "0.4.11"
serde = "1.0.112"
serde_derive = "1.0.103"
sha2 = "0.8.2"
sha2 = "0.9.2"
solana-frozen-abi-macro = { path = "macro", version = "1.6.0" }
thiserror = "1.0"

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())
}
}