Skip to content

Commit

Permalink
sha1-checked: bump digest to 0.11.0-pre.8 (#581)
Browse files Browse the repository at this point in the history
  • Loading branch information
baloo authored May 15, 2024
1 parent e7f7317 commit 06bc6fa
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 97 deletions.
120 changes: 28 additions & 92 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ opt-level = 2
[patch.crates-io]
# https://github.com/RustCrypto/traits/pull/1537 - Unreleased
digest = { git = "https://github.com/RustCrypto/traits.git" }

sha1 = { path = "./sha1" }
8 changes: 4 additions & 4 deletions sha1-checked/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sha1-checked"
version = "0.10.0"
version = "0.11.0-pre"
description = "SHA-1 hash function with collision detection"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
Expand All @@ -18,12 +18,12 @@ exclude = [
]

[dependencies]
digest = "0.10.7"
sha1 = { version = "0.10.6", default-features = false, features = ["compress"] }
digest = "=0.11.0-pre.8"
sha1 = { version = "=0.11.0-pre.3", default-features = false }
zeroize = { version = "1.7", default-features = false, optional = true }

[dev-dependencies]
digest = { version = "0.10.7", features = ["dev"] }
digest = { version = "=0.11.0-pre.8", features = ["dev"] }
hex-literal = "0.4"

[features]
Expand Down
4 changes: 3 additions & 1 deletion sha1-checked/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use core::slice::from_ref;
extern crate std;

use digest::{
array::Array,
block_buffer::{BlockBuffer, Eager},
core_api::BlockSizeUser,
typenum::{Unsigned, U20, U64},
Expand Down Expand Up @@ -114,7 +115,7 @@ impl Sha1 {
compress::finalize(h, bs * self.block_len, last_block, ctx);
} else {
let bit_len = 8 * (buffer.get_pos() as u64 + bs * self.block_len);
buffer.len64_padding_be(bit_len, |b| sha1::compress(h, from_ref(b)));
buffer.len64_padding_be(bit_len, |b| sha1::compress(h, from_ref(b.into())));
}

for (chunk, v) in out.chunks_exact_mut(4).zip(h.iter()) {
Expand Down Expand Up @@ -187,6 +188,7 @@ impl Update for Sha1 {
unsafe { &*(blocks as *const _ as *const [[u8; BLOCK_SIZE]]) };
compress::compress(h, ctx, blocks);
} else {
let blocks = Array::cast_slice_to_core(blocks);
sha1::compress(h, blocks);
}
});
Expand Down

0 comments on commit 06bc6fa

Please sign in to comment.