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

@@ -105,7 +105,6 @@ fn pack_platform(
) -> Result<()> {
let base_dir = match platform {
Platform::Mac => path::Path::new(dist_dir).join("mac"),
// TODO: Verify this.
Platform::Linux => path::Path::new(dist_dir).join("linux-unpacked"),
Platform::Windows => path::Path::new(dist_dir).join("win-unpacked"),
};
@@ -133,7 +132,7 @@ fn sha256_digest<R: io::Read>(mut reader: &mut R) -> Result<HashSum> {
let mut sha256 = Sha256::new();
std::io::copy(&mut reader, &mut sha256)?;
let hash = sha256.result();
let hash = sha256.finalize();
Ok(HashSum(data_encoding::HEXLOWER.encode(&hash)))
}

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