Skip to content

Commit

Permalink
fix(password-hash): Update to use CryptoRng
Browse files Browse the repository at this point in the history
  • Loading branch information
GeekMasher committed Feb 9, 2025
1 parent 19cd820 commit 09041c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions password-hash/src/salt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use core::{fmt, str};

use crate::errors::InvalidValue;
#[cfg(feature = "rand_core")]
use rand_core::RngCore;
use rand_core::CryptoRng;

/// Error message used with `expect` for when internal invariants are violated
/// (i.e. the contents of a [`Salt`] should always be valid)
Expand Down Expand Up @@ -203,7 +203,7 @@ pub struct SaltString {
impl SaltString {
/// Generate a random B64-encoded [`SaltString`].
#[cfg(feature = "rand_core")]
pub fn generate(mut rng: impl RngCore) -> Self {
pub fn generate(mut rng: impl CryptoRng) -> Self {
let mut bytes = [0u8; Salt::RECOMMENDED_LENGTH];
rng.fill_bytes(&mut bytes);
Self::encode_b64(&bytes).expect(INVARIANT_VIOLATED_MSG)
Expand Down

0 comments on commit 09041c7

Please sign in to comment.