Struct argon2rs::verifier::Encoded
[−]
[src]
pub struct Encoded { /* fields omitted */ }
Represents a single Argon2 hashing session. A hash session comprises of the hash algorithm parameters, salt, key, and data used to hash a given input.
Methods
impl Encoded
[src]
fn from_u8(encoded: &[u8]) -> Result<Self, DecodeError>
Reconstruct a previous hash session from serialized bytes.
fn to_u8(&self) -> Vec<u8>
Serialize this hashing session into raw bytes that can later be
recovered by Encoded::from_u8
.
fn new(argon: Argon2, p: &[u8], s: &[u8], k: &[u8], x: &[u8]) -> Self
Generates a new hashing session from password, salt, and other byte input. Parameters are:
argon
: An Argon2
struct representative of the desired hash algorithm
parameters.
p
: Password input.
s
: Salt.
k
: An optional secret value.
x
: Optional, miscellaneous associated data.
Note that p, s, k, x
must conform to the same length constraints
dictated by Argon2::hash
.
fn default2i(p: &[u8], s: &[u8], k: &[u8], x: &[u8]) -> Self
Same as Encoded::new
, but with the default Argon2i hash algorithm
parameters.
fn default2d(p: &[u8], s: &[u8], k: &[u8], x: &[u8]) -> Self
Same as Encoded::new
, but with the default Argon2d hash algorithm
parameters.
fn verify(&self, p: &[u8]) -> bool
Verifies password input against the hash that was previously created in this hashing session.