Struct sarkara::pwhash::Argon2i
[−]
[src]
pub struct Argon2i { /* fields omitted */ }
Argon2i.
Example(keyderive)
use seckey::Bytes; use sarkara::pwhash::{ Argon2i, KeyDerive }; let (pass, salt) = (rand!(8), rand!(8)); let key = Argon2i::default() .derive::<Bytes>(&pass, &salt) .unwrap();Run
Example(pwhash)
use seckey::Bytes; use sarkara::pwhash::{ Argon2i, KeyDerive }; let pass = rand!(8); let key = Argon2i::default() .with_size(16) .pwhash::<Bytes>(&pass) .unwrap();Run
Example(keyverify)
use seckey::Bytes; use sarkara::pwhash::{ Argon2i, KeyDerive, KeyVerify }; let (pass, salt) = (rand!(8), rand!(8)); let key = Argon2i::default() .derive::<Bytes>(&pass, &salt) .unwrap(); assert!(Argon2i::default().verify(&pass, &salt, &key).unwrap());Run
Trait Implementations
impl Debug for Argon2i
[src]
impl Clone for Argon2i
[src]
fn clone(&self) -> Argon2i
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Default for Argon2i
[src]
impl KeyDerive for Argon2i
[src]
fn with_size(&mut self, len: usize) -> &mut Self
Set output length.
fn with_key(&mut self, key: &[u8]) -> &mut Self
Set key.
fn with_aad(&mut self, aad: &[u8]) -> &mut Self
Set associated data.
fn with_opslimit(&mut self, opslimit: u32) -> &mut Self
Set opslimit parameter.
fn with_memlimit(&mut self, memlimit: u32) -> &mut Self
Set memlimit parameter.
fn derive<K>(&self, password: &[u8], salt: &[u8]) -> Result<K, KeyDerivationFail> where K: From<Vec<u8>>
Derive key. Read more
fn pwhash<K>(&self, password: &[u8]) -> Result<K, KeyDerivationFail> where K: From<Vec<u8>>
Generate a hashed password. Read more