Compare commits

...

2 Commits

Author SHA1 Message Date
Anna fae03a94e5
chore: remove useless clone 2023-08-31 00:52:21 -04:00
Anna fae0f91405
feat: add asm sha1 implementation 2023-08-31 00:51:49 -04:00
3 changed files with 12 additions and 6 deletions

10
Cargo.lock generated
View File

@ -2064,6 +2064,16 @@ dependencies = [
"cfg-if",
"cpufeatures",
"digest 0.10.7",
"sha1-asm",
]
[[package]]
name = "sha1-asm"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ba6947745e7f86be3b8af00b7355857085dbdf8901393c89514510eb61f4e21"
dependencies = [
"cc",
]
[[package]]

View File

@ -22,5 +22,5 @@ num_cpus = "1"
rand = "0.8"
sequoia-openpgp = { git = "https://gitlab.com/sequoia-pgp/sequoia" }
serde = { version = "1", features = ["derive"] }
sha1 = "0.10"
sha1 = { version = "0.10", features = ["asm"] }
toml = "0.7"

View File

@ -450,7 +450,6 @@ fn main() -> Result<()> {
.context("missing timestamp")?
.parse::<i64>()
.context("invalid timestamp")?;
// let original = timestamp;
let author_len = author_parts.len();
let committer_len = committer_parts.len();
@ -472,7 +471,6 @@ fn main() -> Result<()> {
let timestamp = Arc::clone(&timestamp);
let message = message.clone();
let byte_prefix = byte_prefix.clone();
let nibble_values = nibble_values.clone();
let mut author_parts = author_parts.clone();
let mut committer_parts = committer_parts.clone();
let mut header_lines = header_lines.clone();
@ -630,10 +628,8 @@ fn main() -> Result<()> {
}
let hash = sha1.finalize_reset();
// let hash = data_encoding::HEXLOWER.encode(&hash);
bar.inc(1);
// if hash.starts_with(&prefix) {
if hash[0..byte_prefix.len()] == byte_prefix {
// check the nibble
if let Some(values) = nibble_values {