Trait libpasta::primitives::PrimitiveImpl
[−]
[src]
pub trait PrimitiveImpl: Debug + Send + Sync { fn compute(&self, password: &[u8], salt: &[u8]) -> Vec<u8>; fn params_as_vec(&self) -> Vec<(&'static str, String)>; fn hash_id(&self) -> Hashes; fn verify(&self, password: &[u8], salt: &[u8], hash: &[u8]) -> bool { ... } }
Trait defining the functionality of a hashing primitive.
Required Methods
fn compute(&self, password: &[u8], salt: &[u8]) -> Vec<u8>
Compute the output of the primitive with input password
and salt
.
fn params_as_vec(&self) -> Vec<(&'static str, String)>
Output the parameters of the primitive as a list of tuples.
fn hash_id(&self) -> Hashes
Return algorithm type as a MCF-compatible hash identifier.
Provided Methods
fn verify(&self, password: &[u8], salt: &[u8], hash: &[u8]) -> bool
Verify the password and salt against the hash.
In many cases, this just checks whether
compute(password, salt) == hash
.
Trait Implementations
impl PartialEq<PrimitiveImpl> for PrimitiveImpl
[src]
fn eq(&self, other: &PrimitiveImpl) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl PartialOrd<PrimitiveImpl> for PrimitiveImpl
[src]
Compare two primitive parameterisations by first checking for equality of the hash identifiers, and then attempting to compare the parameters numerically.
fn partial_cmp(&self, other: &PrimitiveImpl) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more