diff options
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | Cargo.lock | 67 | ||||
| -rw-r--r-- | Cargo.toml | 3 | ||||
| -rw-r--r-- | src/core.rs | 4 | ||||
| -rw-r--r-- | tests/cli.rs | 4 |
5 files changed, 46 insertions, 34 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 54fc0be..45d625f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ The format is based on [Keep A Changelog][] and this project adheres to - Updated Nix flake inputs - Updated Rust dependencies +- Upgraded `sha2` crate +- Added dependency on `digest-io` crate ## [0.1.3] - 2025-08-23 @@ -126,11 +126,11 @@ checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" [[package]] name = "block-buffer" -version = "0.10.4" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +checksum = "cdd35008169921d80bc60d3d0ab416eecb028c4cd653352907921d95084790be" dependencies = [ - "generic-array", + "hybrid-array", ] [[package]] @@ -152,6 +152,7 @@ dependencies = [ "chrono", "clap", "ctrlc", + "digest-io", "either", "filetime", "flate2", @@ -269,6 +270,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" [[package]] +name = "const-oid" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" + +[[package]] name = "core-foundation-sys" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -276,9 +283,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.17" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" dependencies = [ "libc", ] @@ -328,12 +335,11 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crypto-common" -version = "0.1.7" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +checksum = "77727bb15fa921304124b128af125e7e3b968275d1b108b379190264f4423710" dependencies = [ - "generic-array", - "typenum", + "hybrid-array", ] [[package]] @@ -355,15 +361,25 @@ checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" [[package]] name = "digest" -version = "0.10.7" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +checksum = "4850db49bf08e663084f7fb5c87d202ef91a3907271aff24a94eb97ff039153c" dependencies = [ "block-buffer", + "const-oid", "crypto-common", ] [[package]] +name = "digest-io" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2de63d600bc7fab91180bc17385f29b342468dc8ef2af09dceba450a293de3da" +dependencies = [ + "digest", +] + +[[package]] name = "dispatch2" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -452,16 +468,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] name = "getrandom" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -529,6 +535,15 @@ dependencies = [ ] [[package]] +name = "hybrid-array" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3944cf8cf766b40e2a1a333ee5e9b563f854d5fa49d6a8ca2764e97c6eddb214" +dependencies = [ + "typenum", +] + +[[package]] name = "iana-time-zone" version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -928,9 +943,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.9" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" dependencies = [ "cfg-if", "cpufeatures", @@ -1035,12 +1050,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] name = "wait-timeout" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -16,6 +16,7 @@ anyhow = "1.0.102" chrono = { version = "0.4.44", features = ["serde"] } clap = { version = "4.6.0", features = ["derive", "wrap_help"] } ctrlc = "3.5.2" +digest-io = "0.1.0" either = "1.15.0" flate2 = "1.1.9" hex = { version = "0.4.3", features = ["serde"] } @@ -23,7 +24,7 @@ itertools = "0.14.0" parseq = "0.1.5" serde = { version = "1.0.228", features = ["derive"] } serde_json = "1.0.149" -sha2 = "0.10.9" +sha2 = "0.11.0" walkdir = "2.5.0" [target.'cfg(target_os = "openbsd")'.dependencies] diff --git a/src/core.rs b/src/core.rs index 7e4aadb..0f27a80 100644 --- a/src/core.rs +++ b/src/core.rs @@ -87,7 +87,7 @@ impl Record { ) -> Result<Record, RecordError> { let modified = std::fs::symlink_metadata(&path)?.modified()?; let mut file = std::fs::File::open(&path)?; - let mut hasher = Sha256::new(); + let mut hasher = digest_io::IoWrapper(Sha256::new()); loop { if terminate.load(std::sync::atomic::Ordering::SeqCst) { return Err(RecordError::Interrupt); @@ -97,7 +97,7 @@ impl Record { break; } } - let hash = hasher.finalize(); + let hash = hasher.0.finalize(); Ok(Record { path: path.as_ref().into(), modified: modified.into(), diff --git a/tests/cli.rs b/tests/cli.rs index 2846a62..745d17d 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -292,8 +292,8 @@ fn long_help() -> TestResult { fn sha256<P: AsRef<Path>>(path: P) -> Result<Vec<u8>, std::io::Error> { let mut file = File::open(path)?; - let mut hasher = Sha256::new(); + let mut hasher = digest_io::IoWrapper(Sha256::new()); std::io::copy(&mut file, &mut hasher)?; - let hash = hasher.finalize(); + let hash = hasher.0.finalize(); Ok(hash.as_slice().into()) } |