Skip to content

Commit d74c38e

Browse files
AlexMikhalevTest User
andauthored
fix(terraphim_update): use hex::encode for sha2 0.11 output (#939)
sha2 0.11's finalize() output no longer implements LowerHex via the format! macro. Add hex crate and encode the digest explicitly. Refs #911 Co-authored-by: Test User <test@test.com>
1 parent d549465 commit d74c38e

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/terraphim_update/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ chrono = { workspace = true }
2929

3030
semver = "1.0"
3131
sha2 = "0.11"
32+
hex = "0.4"
3233
ureq = "2.9"
3334
dirs = "5.0"
3435
dialoguer = "0.12"

crates/terraphim_update/src/rollback.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl Backup {
4747
let mut hasher = Sha256::new();
4848
hasher.update(&contents);
4949
let result = hasher.finalize();
50-
Ok(format!("{:x}", result))
50+
Ok(hex::encode(result))
5151
}
5252

5353
/// Verify that the backup file is intact
@@ -185,7 +185,7 @@ impl BackupManager {
185185
let mut hasher = Sha256::new();
186186
hasher.update(&contents);
187187
let result = hasher.finalize();
188-
Ok(format!("{:x}", result))
188+
Ok(hex::encode(result))
189189
}
190190

191191
/// Rotate backups to maintain the maximum count

0 commit comments

Comments
 (0)