Skip to content

Commit c19e777

Browse files
Update to sha2-0.11
This version dropped the ability to format hashes as hex, so add a dependency on base16ct to take care of that as recommended here: RustCrypto/hybrid-array#201 (comment)
1 parent 4a75710 commit c19e777

3 files changed

Lines changed: 39 additions & 25 deletions

File tree

Cargo.lock

Lines changed: 35 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ovmf-prebuilt/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ repository = "https://github.com/rust-osdev/ovmf-prebuilt"
99
description = "Library to download and cache OVMF prebuilt binaries"
1010

1111
[dependencies]
12+
base16ct = "1.0.0"
1213
log = "0.4"
1314
lzma-rs = "0.3"
14-
sha2 = "0.10"
15+
sha2 = "0.11"
1516
tar = "0.4"
1617
ureq.workspace = true

ovmf-prebuilt/src/fetch.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::{Error, Source};
2+
use base16ct::HexDisplay;
23
use log::info;
34
use sha2::{Digest, Sha256};
45
use std::io::{self, Cursor, Read};
@@ -38,7 +39,7 @@ pub(crate) fn update_cache(source: Source, prebuilt_dir: &Path) -> Result<(), Er
3839
let data = retry(MAX_DOWNLOAD_RETRIES, || download_url(&url))?;
3940

4041
// Validate the hash.
41-
let actual_hash = format!("{:x}", Sha256::digest(&data));
42+
let actual_hash = format!("{:x}", HexDisplay(&Sha256::digest(&data)));
4243
if actual_hash != source.sha256 {
4344
return Err(Error::HashMismatch {
4445
actual: actual_hash,

0 commit comments

Comments
 (0)