pub enum Argon2id {}
Available on crate feature
rust-argon2
only.Expand description
Use this type in the generic constructor to use argon2id
use password_worker::{Argon2id, Argon2idConfig, PasswordWorker};
let password = "hunter2";
let salt: Vec<u8> = get_rand(); // Min length 8 bytes
let max_threads = 4;
let password_worker = PasswordWorker::<Argon2id>::new(max_threads)?;
// let password_worker = PasswordWorker::new_argon2id(max_threads)?;
let hashed_password = password_worker
.hash(
password,
Argon2idConfig {
salt,
..Default::default()
},
)
.await?;
println!("Hashed password: {:?}", hashed_password);
let is_valid = password_worker.verify(password, hashed_password).await?;
println!("Verification result: {:?}", is_valid);
Trait Implementations§
Source§impl Hasher for Argon2id
impl Hasher for Argon2id
impl Copy for Argon2id
Auto Trait Implementations§
impl Freeze for Argon2id
impl RefUnwindSafe for Argon2id
impl Send for Argon2id
impl Sync for Argon2id
impl Unpin for Argon2id
impl UnwindSafe for Argon2id
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more