diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-04-23 11:18:20 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-04-23 11:18:20 +0300 |
commit | 28c1652e0fa61563def69343141ac6c06854eaa6 (patch) | |
tree | 31836b7a5d22f50b5e7d8699fe75ee44ce156c56 | |
parent | 35f3c2a309b7a39a079dc8223d3cc8da3f6704f7 (diff) | |
download | summain-rs-28c1652e0fa61563def69343141ac6c06854eaa6.tar.gz |
move hashing to func
-rw-r--r-- | src/lib.rs | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -97,12 +97,16 @@ fn file_checksum(path: PathBuf) -> std::io::Result<String> { if n == 0 { break; } - hasher.update(&buf[..n]); + update_checksum(&mut hasher, &buf[..n]); } let hash = hasher.finalize(); Ok(format!("{:x}", hash)) } +fn update_checksum(hasher: &mut Sha256, data: &[u8]) { + hasher.update(data); +} + mod mode { use serde::{self, Serializer}; |