aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/sha1.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/sha1.rs')
-rw-r--r--src/util/sha1.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/util/sha1.rs b/src/util/sha1.rs
index 6684963..6fed18d 100644
--- a/src/util/sha1.rs
+++ b/src/util/sha1.rs
@@ -2,14 +2,15 @@
2 2
3use std::path::Path; 3use std::path::Path;
4 4
5use sha1::{Digest, Sha1}; 5use sha1::{Digest, Sha1, Sha1Core};
6use sha1::digest::core_api::CoreWrapper;
6use tokio::fs::read; 7use tokio::fs::read;
7 8
8use crate::errors::McError; 9use crate::errors::McError;
9 10
10pub async fn sha1_hex(path: &Path) -> Result<String, McError> { 11pub async fn sha1_hex(path: &Path) -> Result<String, McError> {
11 let data = read(path).await?; 12 let data: Vec<u8> = read(path).await?;
12 let mut hasher = Sha1::new(); 13 let mut hasher: CoreWrapper<Sha1Core> = Sha1::new();
13 hasher.update(&data); 14 hasher.update(&data);
14 Ok(format!("{:x}", hasher.finalize())) 15 Ok(format!("{:x}", hasher.finalize()))
15} 16}