Upgrade deps

Summary:
Couldn't do this because we were stuck on an old version
of digest internally with breaking changes. Now there's a
`sha2-9` option to make it build.

Reviewed By: mweststrate

Differential Revision: D26404582

fbshipit-source-id: 9851de3439ea263eaddb558daaf4cf9e73b062cc
This commit is contained in:
Pascal Hartig
2021-02-12 04:41:32 -08:00
committed by Facebook GitHub Bot
parent 7fd0c7d82e
commit f69723978d
4 changed files with 45 additions and 63 deletions

View File

@@ -30,9 +30,9 @@ pub fn tarsum<R: io::Read>(reader: R) -> Result<types::HashSum> {
let mut digest = sha2::Sha256::new();
for (_, file_hash) in map {
digest.input(file_hash.0);
digest.update(file_hash.0);
}
let hash = digest.result();
let hash = digest.finalize();
Ok(types::HashSum(data_encoding::HEXLOWER.encode(&hash)))
}
@@ -40,7 +40,7 @@ fn digest_file<R: io::Read>(reader: &mut R) -> io::Result<types::HashSum> {
use sha2::Digest;
let mut digest = sha2::Sha256::new();
io::copy(reader, &mut digest)?;
let hash = digest.result();
let hash = digest.finalize();
Ok(types::HashSum(data_encoding::HEXLOWER.encode(&hash)))
}