pub struct Argon2<const S: usize>where
Salt<S>: Argon2Compatible,{ /* private fields */ }
Expand description
Argon2 password hashing implementation
This struct provides methods for password hashing using the Argon2 algorithm, which is designed to be resistant against various attacks including GPU cracking and side-channel attacks.
Implementations§
Source§impl<const S: usize> Argon2<S>where
Salt<S>: Argon2Compatible,
impl<const S: usize> Argon2<S>where
Salt<S>: Argon2Compatible,
Sourcepub fn new_with_params(params: Params<S>) -> Self
pub fn new_with_params(params: Params<S>) -> Self
Creates a new Argon2 instance with the specified parameters
Trait Implementations§
Source§impl<const S: usize> KeyDerivationFunction for Argon2<S>
impl<const S: usize> KeyDerivationFunction for Argon2<S>
Source§type Algorithm = Argon2Algorithm
type Algorithm = Argon2Algorithm
The algorithm this KDF implements
Source§fn builder(&self) -> impl KdfOperation<'_, Self::Algorithm>where
Self: Sized,
fn builder(&self) -> impl KdfOperation<'_, Self::Algorithm>where
Self: Sized,
Creates a builder for fluent API usage - FIXED: Elided lifetime
Source§fn generate_salt<R: RngCore + CryptoRng>(rng: &mut R) -> Self::Salt
fn generate_salt<R: RngCore + CryptoRng>(rng: &mut R) -> Self::Salt
Generate a random salt with appropriate size
Source§fn derive_key(
&self,
input: &[u8],
salt_override: Option<&[u8]>,
info_override: Option<&[u8]>,
length_override: usize,
) -> Result<Vec<u8>>
fn derive_key( &self, input: &[u8], salt_override: Option<&[u8]>, info_override: Option<&[u8]>, length_override: usize, ) -> Result<Vec<u8>>
Derives a key using the KDF parameters Read more
Source§fn security_level() -> SecurityLevel
fn security_level() -> SecurityLevel
Returns the security level of the KDF in bits
Source§impl<const S: usize> ParamProvider for Argon2<S>
impl<const S: usize> ParamProvider for Argon2<S>
Source§fn with_params(params: Self::Params) -> Self
fn with_params(params: Self::Params) -> Self
Creates a new instance with the specified parameters
Source§fn set_params(&mut self, params: Self::Params)
fn set_params(&mut self, params: Self::Params)
Updates the parameters
Source§impl<const S: usize> PasswordHashFunction for Argon2<S>
impl<const S: usize> PasswordHashFunction for Argon2<S>
Source§type Password = SecretBytes<32>
type Password = SecretBytes<32>
Password type with zeroizing
Source§fn hash_password(&self, password: &Self::Password) -> Result<PasswordHash>
fn hash_password(&self, password: &Self::Password) -> Result<PasswordHash>
Hashes a password with the configured parameters
Source§fn verify(
&self,
password: &Self::Password,
stored_hash: &PasswordHash,
) -> Result<bool>
fn verify( &self, password: &Self::Password, stored_hash: &PasswordHash, ) -> Result<bool>
Verifies a password against a hash
Source§fn recommended_params(_target_duration: Duration) -> Self::Params
fn recommended_params(_target_duration: Duration) -> Self::Params
Recommends parameters based on a target duration
Auto Trait Implementations§
impl<const S: usize> Freeze for Argon2<S>
impl<const S: usize> RefUnwindSafe for Argon2<S>
impl<const S: usize> Send for Argon2<S>
impl<const S: usize> Sync for Argon2<S>
impl<const S: usize> Unpin for Argon2<S>
impl<const S: usize> UnwindSafe for Argon2<S>
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