pub struct Argon2<'key> { /* private fields */ }
Expand description
Implementations§
§impl<'key> Argon2<'key>
impl<'key> Argon2<'key>
pub fn new(
algorithm: Algorithm,
version: Version,
params: Params
) -> Argon2<'key>
pub fn new( algorithm: Algorithm, version: Version, params: Params ) -> Argon2<'key>
Create a new Argon2 context.
pub fn new_with_secret(
secret: &'key [u8],
algorithm: Algorithm,
version: Version,
params: Params
) -> Result<Argon2<'key>, Error>
pub fn new_with_secret( secret: &'key [u8], algorithm: Algorithm, version: Version, params: Params ) -> Result<Argon2<'key>, Error>
Create a new Argon2 context.
pub fn hash_password_into(
&self,
pwd: &[u8],
salt: &[u8],
out: &mut [u8]
) -> Result<(), Error>
pub fn hash_password_into( &self, pwd: &[u8], salt: &[u8], out: &mut [u8] ) -> Result<(), Error>
Hash a password and associated parameters into the provided output buffer.
pub fn hash_password_into_with_memory(
&self,
pwd: &[u8],
salt: &[u8],
out: &mut [u8],
memory_blocks: impl AsMut<[Block]>
) -> Result<(), Error>
pub fn hash_password_into_with_memory( &self, pwd: &[u8], salt: &[u8], out: &mut [u8], memory_blocks: impl AsMut<[Block]> ) -> Result<(), Error>
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.
pub fn fill_memory(
&self,
pwd: &[u8],
salt: &[u8],
memory_blocks: impl AsMut<[Block]>
) -> Result<(), Error>
pub fn fill_memory( &self, pwd: &[u8], salt: &[u8], memory_blocks: impl AsMut<[Block]> ) -> Result<(), Error>
Use a password and associated parameters only to fill the given memory blocks.
This method omits the calculation of a hash and can be used when only the filled memory is required. It is not necessary to call this method before calling any of the hashing functions.
Trait Implementations§
§impl PasswordHasher for Argon2<'_>
impl PasswordHasher for Argon2<'_>
§fn hash_password<'a>(
&self,
password: &[u8],
salt: impl Into<Salt<'a>>
) -> Result<PasswordHash<'a>, Error>
fn hash_password<'a>( &self, password: &[u8], salt: impl Into<Salt<'a>> ) -> Result<PasswordHash<'a>, Error>
Simple API for computing a
PasswordHash
from a password and
salt value. Read more§fn hash_password_customized<'a>(
&self,
password: &[u8],
alg_id: Option<Ident<'a>>,
version: Option<u32>,
params: Params,
salt: impl Into<Salt<'a>>
) -> Result<PasswordHash<'a>, Error>
fn hash_password_customized<'a>( &self, password: &[u8], alg_id: Option<Ident<'a>>, version: Option<u32>, params: Params, salt: impl Into<Salt<'a>> ) -> Result<PasswordHash<'a>, Error>
Compute a
PasswordHash
from the provided password using an
explicit set of customized algorithm parameters as opposed to the
defaults. Read moreAuto 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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> PasswordVerifier for Twhere
T: PasswordHasher,
impl<T> PasswordVerifier for Twhere T: PasswordHasher,
§fn 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.