diff options
Diffstat (limited to '')
| -rw-r--r-- | src/util/sha1.rs | 7 |
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 | ||
| 3 | use std::path::Path; | 3 | use std::path::Path; |
| 4 | 4 | ||
| 5 | use sha1::{Digest, Sha1}; | 5 | use sha1::{Digest, Sha1, Sha1Core}; |
| 6 | use sha1::digest::core_api::CoreWrapper; | ||
| 6 | use tokio::fs::read; | 7 | use tokio::fs::read; |
| 7 | 8 | ||
| 8 | use crate::errors::McError; | 9 | use crate::errors::McError; |
| 9 | 10 | ||
| 10 | pub async fn sha1_hex(path: &Path) -> Result<String, McError> { | 11 | pub 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 | } |
