Skip to content

Commit 8a1c43f

Browse files
committed
chore: Update to sha2 0.9
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
1 parent a9cfc29 commit 8a1c43f

File tree

5 files changed

+17
-47
lines changed

5 files changed

+17
-47
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ same-file = "1"
4545
scopeguard = "1"
4646
semver = "0.10"
4747
serde = {version = "1.0", features = ["derive"]}
48-
sha2 = "0.8"
48+
sha2 = "0.9"
4949
strsim = "0.10"
5050
tar = "0.4.26"
5151
tempfile = "3.1"

src/dist/download.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'a> DownloadCfg<'a> {
8686
}
8787
};
8888

89-
let actual_hash = format!("{:x}", hasher.result());
89+
let actual_hash = format!("{:x}", hasher.finalize());
9090

9191
if hash != actual_hash {
9292
// Incorrect hash
@@ -213,7 +213,7 @@ impl<'a> DownloadCfg<'a> {
213213
utils::download_file(&url, &file, Some(&mut hasher), &|n| {
214214
(self.notify_handler)(n.into())
215215
})?;
216-
let actual_hash = format!("{:x}", hasher.result());
216+
let actual_hash = format!("{:x}", hasher.finalize());
217217

218218
if hash != actual_hash {
219219
// Incorrect hash
@@ -251,8 +251,8 @@ fn file_hash(path: &Path, notify_handler: &dyn Fn(Notification<'_>)) -> Result<S
251251
if n == 0 {
252252
break;
253253
}
254-
hasher.input(&buf[..n]);
254+
hasher.update(&buf[..n]);
255255
}
256256

257-
Ok(format!("{:x}", hasher.result()))
257+
Ok(format!("{:x}", hasher.finalize()))
258258
}

src/utils/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ fn download_file_(
220220
let callback: &dyn Fn(Event<'_>) -> download::Result<()> = &|msg| {
221221
if let Event::DownloadDataReceived(data) = msg {
222222
if let Some(h) = hasher.borrow_mut().as_mut() {
223-
h.input(data);
223+
h.update(data);
224224
}
225225
}
226226

tests/mock/dist.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,8 @@ pub fn calc_hash(src: &Path) -> String {
490490
let mut buf = Vec::new();
491491
File::open(src).unwrap().read_to_end(&mut buf).unwrap();
492492
let mut hasher = Sha256::new();
493-
hasher.input(buf);
494-
format!("{:x}", hasher.result())
493+
hasher.update(buf);
494+
format!("{:x}", hasher.finalize())
495495
}
496496

497497
pub fn create_hash(src: &Path, dst: &Path) -> String {

0 commit comments

Comments
 (0)