pub struct Stored {
pub iterations: u32,
pub salt: Vec<u8>,
pub digest: Vec<u8>,
}Expand description
A password hash, parsed from or destined for .env.
Fields§
§iterations: u32The rounds this hash was made with — not ITERATIONS, unless it was just made.
salt: Vec<u8>§digest: Vec<u8>Implementations§
Source§impl Stored
impl Stored
Sourcepub fn hash(password: &str) -> Result<Stored>
pub fn hash(password: &str) -> Result<Stored>
Hash a password with a fresh 16-byte salt and ITERATIONS rounds.
Sourcepub fn parse(text: &str) -> Result<Stored, String>
pub fn parse(text: &str) -> Result<Stored, String>
Parse pbkdf2-sha256$<iterations>$<salt-hex>$<digest-hex>.
Strict on purpose: four fields, the scheme tag, decimal iterations in a sane range, and two
even-length hex strings. A lenient parser here would turn a typo in .env into “wrong
password” for every attempt, which is the least debuggable failure a login has.
Trait Implementations§
impl Eq for Stored
impl StructuralPartialEq for Stored
Auto Trait Implementations§
impl Forget for Stored
impl Freeze for Stored
impl Move for Stored
impl RefUnwindSafe for Stored
impl Send for Storedwhere
RawVecInner: Send,
impl Sync for Storedwhere
RawVecInner: Sync,
impl Unpin for Stored
impl UnsafeUnpin for Stored
impl UnwindSafe for Storedwhere
RawVecInner: UnwindSafe,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.