Skip to content

Commit 3216743

Browse files
committed
chore(deps): use digest newtype
1 parent 68c5d80 commit 3216743

File tree

3 files changed

+32
-42
lines changed

3 files changed

+32
-42
lines changed

Cargo.lock

Lines changed: 10 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,12 @@ opt-level = 2
1818

1919
[patch.crates-io]
2020
password-hash = { git = "https://github.com/RustCrypto/traits.git" }
21+
crypto-common = { git = "https://github.com/RustCrypto/traits.git" }
22+
digest = { git = "https://github.com/RustCrypto/traits.git" }
23+
24+
blake2 = { git = "https://github.com/RustCrypto/hashes.git" }
25+
streebog = { git = "https://github.com/RustCrypto/hashes.git" }
26+
sha1 = { git = "https://github.com/RustCrypto/hashes.git" }
27+
sha2 = { git = "https://github.com/RustCrypto/hashes.git" }
28+
29+
hmac = { git = "https://github.com/RustCrypto/MACs.git" }

pbkdf2/src/lib.rs

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,13 @@ use rayon::prelude::*;
103103
use digest::{FixedOutput, InvalidLength, KeyInit, Update, typenum::Unsigned};
104104

105105
#[cfg(feature = "hmac")]
106-
use digest::{
107-
HashMarker,
108-
block_buffer::Eager,
109-
core_api::{BlockSizeUser, BufferKindUser, FixedOutputCore, UpdateCore},
110-
typenum::{IsLess, Le, NonZero, U256},
106+
use {
107+
digest::{
108+
HashMarker,
109+
block_api::BlockSizeUser,
110+
typenum::{IsLess, NonZero, True, U256},
111+
},
112+
hmac::block_api::EagerHash,
111113
};
112114

113115
#[inline(always)]
@@ -230,16 +232,9 @@ where
230232
#[cfg_attr(docsrs, doc(cfg(feature = "hmac")))]
231233
pub fn pbkdf2_hmac<D>(password: &[u8], salt: &[u8], rounds: u32, res: &mut [u8])
232234
where
233-
D: hmac::EagerHash,
234-
D::Core: Sync
235-
+ HashMarker
236-
+ UpdateCore
237-
+ FixedOutputCore
238-
+ BufferKindUser<BufferKind = Eager>
239-
+ Default
240-
+ Clone,
241-
<D::Core as BlockSizeUser>::BlockSize: IsLess<U256>,
242-
Le<<D::Core as BlockSizeUser>::BlockSize, U256>: NonZero,
235+
D: EagerHash + HashMarker + Update + FixedOutput + Default + Clone,
236+
<D as EagerHash>::Core: Sync,
237+
<D as BlockSizeUser>::BlockSize: IsLess<U256, Output = True> + NonZero,
243238
{
244239
crate::pbkdf2::<hmac::Hmac<D>>(password, salt, rounds, res)
245240
.expect("HMAC can be initialized with any key length");
@@ -262,16 +257,9 @@ where
262257
#[cfg_attr(docsrs, doc(cfg(feature = "hmac")))]
263258
pub fn pbkdf2_hmac_array<D, const N: usize>(password: &[u8], salt: &[u8], rounds: u32) -> [u8; N]
264259
where
265-
D: hmac::EagerHash,
266-
D::Core: Sync
267-
+ HashMarker
268-
+ UpdateCore
269-
+ FixedOutputCore
270-
+ BufferKindUser<BufferKind = Eager>
271-
+ Default
272-
+ Clone,
273-
<D::Core as BlockSizeUser>::BlockSize: IsLess<U256>,
274-
Le<<D::Core as BlockSizeUser>::BlockSize, U256>: NonZero,
260+
D: EagerHash + HashMarker + Update + FixedOutput + Default + Clone,
261+
<D as EagerHash>::Core: Sync,
262+
<D as BlockSizeUser>::BlockSize: IsLess<U256, Output = True> + NonZero,
275263
{
276264
let mut buf = [0u8; N];
277265
pbkdf2_hmac::<D>(password, salt, rounds, &mut buf);

0 commit comments

Comments
 (0)