#[non_exhaustive]pub struct Hash {
pub password: String,
pub hash: String,
}
Expand description
A struct for storing and verifying hashed passwords based on the blake3 crate.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.password: String
The password.
hash: String
The password hash.
Implementations§
source§impl Hash
impl Hash
sourcepub fn entropy(&self) -> f64
pub fn entropy(&self) -> f64
Calculates the entropy of the hash in bits based on the Shannon entropy formula. https://en.wikipedia.org/wiki/Entropy`
sourcepub fn generate_hash(&self) -> String
pub fn generate_hash(&self) -> String
Hashes the password.
sourcepub fn hash_length(&self) -> usize
pub fn hash_length(&self) -> usize
Returns the hash length.
sourcepub fn password_length(&self) -> usize
pub fn password_length(&self) -> usize
Returns the password length.
sourcepub fn set_password(&mut self, password: &str)
pub fn set_password(&mut self, password: &str)
Sets the password and updates the hash.
Trait Implementations§
source§impl PartialEq<Hash> for Hash
impl PartialEq<Hash> for Hash
source§impl PartialOrd<Hash> for Hash
impl PartialOrd<Hash> for Hash
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more