Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sha1-checked: bump digest to 0.11.0-pre.8 #581

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading