pub struct Argon2<'key> { /* private fields */ }
Expand description
Implementations
sourceimpl<'key> Argon2<'key>
impl<'key> Argon2<'key>
sourcepub fn new(algorithm: Algorithm, version: Version, params: Params) -> Self
pub fn new(algorithm: Algorithm, version: Version, params: Params) -> Self
Create a new Argon2 context.
sourcepub fn new_with_secret(
secret: &'key [u8],
algorithm: Algorithm,
version: Version,
params: Params
) -> Result<Self>
pub fn new_with_secret(
secret: &'key [u8],
algorithm: Algorithm,
version: Version,
params: Params
) -> Result<Self>
Create a new Argon2 context.
sourcepub fn hash_password_into(
&self,
pwd: &[u8],
salt: &[u8],
out: &mut [u8]
) -> Result<()>
Available on crate feature alloc
only.
pub fn hash_password_into(
&self,
pwd: &[u8],
salt: &[u8],
out: &mut [u8]
) -> Result<()>
alloc
only.Hash a password and associated parameters into the provided output buffer.
sourcepub fn hash_password_into_with_memory(
&self,
pwd: &[u8],
salt: &[u8],
out: &mut [u8],
memory_blocks: impl AsMut<[Block]>
) -> Result<()>
pub fn hash_password_into_with_memory(
&self,
pwd: &[u8],
salt: &[u8],
out: &mut [u8],
memory_blocks: impl AsMut<[Block]>
) -> Result<()>
Hash a password and associated parameters into the provided output buffer.
This method takes an explicit memory_blocks
parameter which allows
the caller to provide the backing storage for the algorithm’s state:
- Users with the
alloc
feature enabled can useArgon2::hash_password_into
to have it allocated for them. no_std
users on “heapless” targets can use an array of theBlock
type to stack allocate this buffer.
Trait Implementations
sourceimpl PasswordHasher for Argon2<'_>
Available on crate features alloc
and password-hash
only.
impl PasswordHasher for Argon2<'_>
alloc
and password-hash
only.sourcefn hash_password<'a, S>(
&self,
password: &[u8],
salt: &'a S
) -> Result<PasswordHash<'a>> where
S: AsRef<str> + ?Sized,
fn hash_password<'a, S>(
&self,
password: &[u8],
salt: &'a S
) -> Result<PasswordHash<'a>> where
S: AsRef<str> + ?Sized,
Simple API for computing a PasswordHash
from a password and
salt value. Read more
sourcefn hash_password_customized<'a>(
&self,
password: &[u8],
alg_id: Option<Ident<'a>>,
version: Option<Decimal>,
params: Params,
salt: impl Into<Salt<'a>>
) -> Result<PasswordHash<'a>>
fn hash_password_customized<'a>(
&self,
password: &[u8],
alg_id: Option<Ident<'a>>,
version: Option<Decimal>,
params: Params,
salt: impl Into<Salt<'a>>
) -> Result<PasswordHash<'a>>
Compute a PasswordHash
from the provided password using an
explicit set of customized algorithm parameters as opposed to the
defaults. Read more
Auto Trait Implementations
impl<'key> RefUnwindSafe for Argon2<'key>
impl<'key> Send for Argon2<'key>
impl<'key> Sync for Argon2<'key>
impl<'key> Unpin for Argon2<'key>
impl<'key> UnwindSafe for Argon2<'key>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> PasswordVerifier for T where
T: PasswordHasher,
impl<T> PasswordVerifier for T where
T: PasswordHasher,
sourcefn verify_password(
&self,
password: &[u8],
hash: &PasswordHash<'_>
) -> Result<(), Error>
fn verify_password(
&self,
password: &[u8],
hash: &PasswordHash<'_>
) -> Result<(), Error>
Compute this password hashing function against the provided password using the parameters from the provided password hash and see if the computed output matches. Read more