pub struct Pbkdf2 { /* private fields */ }Expand description
Derives a key using PBKDF2-HMAC-SHA256 (V1).
Implementations§
Source§impl Pbkdf2
impl Pbkdf2
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a Pbkdf2 key derivation object with default parameters (600,000 iterations).
Sourcepub fn with_params(iterations: u32) -> Self
pub fn with_params(iterations: u32) -> Self
Creates a Pbkdf2 key derivation object with a custom iteration count.
The output key length is always 32 bytes to match SecretKey’s contract.
Sourcepub fn derive(&self, key: &[u8]) -> Result<(SecretKey, DerivationParameters)>
pub fn derive(&self, key: &[u8]) -> Result<(SecretKey, DerivationParameters)>
Derives the key using a randomly generated salt.
Sourcepub fn derive_with_salt(
&self,
key: &[u8],
salt: &[u8],
) -> Result<(SecretKey, DerivationParameters)>
pub fn derive_with_salt( &self, key: &[u8], salt: &[u8], ) -> Result<(SecretKey, DerivationParameters)>
Derives the key using the provided salt.
Sourcepub fn parameters(self) -> Result<DerivationParameters>
pub fn parameters(self) -> Result<DerivationParameters>
Returns a DerivationParameters capturing the current PBKDF2 settings with a freshly
generated random salt, without performing any derivation.
Useful for passing custom parameters to crate::password_hash::hash_password_with_parameters.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pbkdf2
impl RefUnwindSafe for Pbkdf2
impl Send for Pbkdf2
impl Sync for Pbkdf2
impl Unpin for Pbkdf2
impl UnsafeUnpin for Pbkdf2
impl UnwindSafe for Pbkdf2
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more