Skip to content

Commit

Permalink
Update sha2 crate to 0.9.0
Browse files Browse the repository at this point in the history
As part of the update to 0.9.0, the RustCrypto suite of crates has changed some function names in their public api:
RustCrypto/traits#43
RustCrypto/hashes#157

This commit updates to the 0.9.x version of the sha2 crate from that suite and changes function calls as appropriate.

Signed-off-by: Scott Macfarlane <smacfarlane@chef.io>
  • Loading branch information
smacfarlane committed Jul 2, 2020
1 parent 3d31c57 commit 87352d5
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 19 deletions.
129 changes: 116 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/builder-api/Cargo.toml
Expand Up @@ -36,7 +36,7 @@ reqwest = "*"
serde = "*"
serde_derive = "*"
serde_json = "*"
sha2 = "= 0.8.2"
sha2 = "*"
toml = { version = "*", default-features = false }
futures = "*"
rand = "*"
Expand Down
4 changes: 2 additions & 2 deletions components/builder-api/src/server/services/memcache.rs
Expand Up @@ -311,6 +311,6 @@ fn member_role_ns_key(origin: &str, account_id: u64) -> String {

fn hash_key(key: &str) -> String {
let mut hasher = Sha512::new();
hasher.input(key);
format!("{:02x}", hasher.result())
hasher.update(key);
format!("{:02x}", hasher.finalize())
}
2 changes: 1 addition & 1 deletion components/builder-jobsrv/Cargo.toml
Expand Up @@ -39,7 +39,7 @@ rand = "*"
r2d2 = "*"
serde = "*"
serde_derive = "*"
sha2 = "= 0.8.2"
sha2 = "*"
toml = { version = "*", default-features = false }

[dependencies.actix-web]
Expand Down
4 changes: 2 additions & 2 deletions components/builder-jobsrv/src/server/log_archiver/local.rs
Expand Up @@ -54,8 +54,8 @@ impl LocalArchiver {
/// as not to run afoul of directory limits.
pub fn archive_path(&self, job_id: u64) -> PathBuf {
let mut hasher = Sha256::default();
hasher.input(job_id.to_string().as_bytes());
let checksum = hasher.result();
hasher.update(job_id.to_string().as_bytes());
let checksum = hasher.finalize();

let mut new_path = self.0.clone();
for byte in checksum.iter().take(4) {
Expand Down

0 comments on commit 87352d5

Please sign in to comment.