From a7f67a9a9c199b6ad4af0dafc7271356851774b5 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 21 Jun 2019 15:58:00 +0200 Subject: [PATCH] depend on crc32fast We can use this to compute fast checksums to test file integrity (not crypto safe). --- Cargo.toml | 1 + src/bin/cipherbench.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index d787bee9..f01f2e15 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,6 +49,7 @@ xdg = "2.2" mio = "0.6" valgrind_request = { version = "1.1", optional = true } textwrap = "0.11" +crc32fast = "1" [features] default = [] diff --git a/src/bin/cipherbench.rs b/src/bin/cipherbench.rs index 790a654f..590c1024 100644 --- a/src/bin/cipherbench.rs +++ b/src/bin/cipherbench.rs @@ -27,6 +27,13 @@ fn main() -> Result<(), Error> { let input = proxmox::sys::linux::random_data(1024*1024)?; + rate_test("crc32", &|| { + let mut crchasher = crc32fast::Hasher::new(); + crchasher.update(&input); + let _checksum = crchasher.finalize(); + input.len() + }); + rate_test("zstd", &|| { zstd::block::compress(&input, 1).unwrap(); input.len()