diff --git a/Cargo.lock b/Cargo.lock index a9226967..e61f987d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,7 +16,7 @@ name = "ascon-hash" version = "0.3.0-pre" dependencies = [ "ascon", - "digest 0.11.0-pre.8", + "digest", "hex", "hex-literal", "spectral", @@ -33,7 +33,7 @@ name = "belt-hash" version = "0.2.0-pre.3" dependencies = [ "belt-block", - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] @@ -41,7 +41,7 @@ dependencies = [ name = "blake2" version = "0.11.0-pre.3" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] @@ -51,22 +51,13 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "847495c209977a90e8aad588b959d0ca9f5dc228096d29a6bd3defd53f35eaec" -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - [[package]] name = "block-buffer" version = "0.11.0-pre.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ded684142010808eb980d9974ef794da2bcf97d13396143b1515e9f0fb4a10e" dependencies = [ - "crypto-common 0.2.0-pre.5", + "crypto-common", "zeroize", ] @@ -76,12 +67,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - [[package]] name = "const-oid" version = "0.10.0-pre.2" @@ -97,16 +82,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - [[package]] name = "crypto-common" version = "0.2.0-pre.5" @@ -118,27 +93,15 @@ dependencies = [ "rand_core", ] -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "blobby", - "block-buffer 0.10.4", - "const-oid 0.9.6", - "crypto-common 0.1.6", -] - [[package]] name = "digest" version = "0.11.0-pre.8" source = "git+https://github.com/RustCrypto/traits.git#7c7a0d2a2caa60e286835051e6ad5fd10a9a9554" dependencies = [ "blobby", - "block-buffer 0.11.0-pre.5", - "const-oid 0.10.0-pre.2", - "crypto-common 0.2.0-pre.5", + "block-buffer", + "const-oid", + "crypto-common", "subtle", "zeroize", ] @@ -147,21 +110,11 @@ dependencies = [ name = "fsb" version = "0.2.0-pre" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", "whirlpool", ] -[[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.2.12" @@ -177,7 +130,7 @@ dependencies = [ name = "gost94" version = "0.11.0-pre" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] @@ -185,7 +138,7 @@ dependencies = [ name = "groestl" version = "0.11.0-pre" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] @@ -214,7 +167,7 @@ dependencies = [ name = "jh" version = "0.2.0-pre" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", "ppv-lite86", ] @@ -223,7 +176,7 @@ dependencies = [ name = "k12" version = "0.4.0-pre" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", "sha3", ] @@ -248,7 +201,7 @@ name = "md-5" version = "0.11.0-pre.3" dependencies = [ "cfg-if", - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] @@ -256,7 +209,7 @@ dependencies = [ name = "md2" version = "0.11.0-pre" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] @@ -264,7 +217,7 @@ dependencies = [ name = "md4" version = "0.11.0-pre" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] @@ -287,38 +240,27 @@ dependencies = [ name = "ripemd" version = "0.2.0-pre" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - [[package]] name = "sha1" version = "0.11.0-pre.3" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] [[package]] name = "sha1-checked" -version = "0.10.0" +version = "0.11.0-pre" dependencies = [ - "digest 0.10.7", + "digest", "hex-literal", - "sha1 0.10.6", + "sha1", "zeroize", ] @@ -328,7 +270,7 @@ version = "0.11.0-pre.3" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] @@ -336,7 +278,7 @@ dependencies = [ name = "sha3" version = "0.11.0-pre.3" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", "keccak", ] @@ -345,7 +287,7 @@ dependencies = [ name = "shabal" version = "0.5.0-pre" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] @@ -353,7 +295,7 @@ dependencies = [ name = "skein" version = "0.2.0-pre" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", "threefish", ] @@ -362,7 +304,7 @@ dependencies = [ name = "sm3" version = "0.5.0-pre.3" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] @@ -376,7 +318,7 @@ checksum = "ae3c15181f4b14e52eeaac3efaeec4d2764716ce9c86da0c934c3e318649c5ba" name = "streebog" version = "0.11.0-pre.3" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] @@ -399,7 +341,7 @@ dependencies = [ name = "tiger" version = "0.3.0-pre" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] @@ -409,12 +351,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -425,7 +361,7 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" name = "whirlpool" version = "0.11.0-pre.2" dependencies = [ - "digest 0.11.0-pre.8", + "digest", "hex-literal", ] diff --git a/Cargo.toml b/Cargo.toml index ece5a908..e94b026b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" } diff --git a/sha1-checked/Cargo.toml b/sha1-checked/Cargo.toml index afd9bae9..4bd320f4 100644 --- a/sha1-checked/Cargo.toml +++ b/sha1-checked/Cargo.toml @@ -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" @@ -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] diff --git a/sha1-checked/src/lib.rs b/sha1-checked/src/lib.rs index 651b0b16..76b1199b 100644 --- a/sha1-checked/src/lib.rs +++ b/sha1-checked/src/lib.rs @@ -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}, @@ -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()) { @@ -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); } });