Skip to main content

iterations

Function iterations 

Source
pub fn iterations(digest: &str) -> Option<u32>
Expand description

The iteration count stored in digest, or None when it is not in Ocre’s format.

Use it to re-hash old passwords after a successful login when the count is lower than ITERATIONS. Parses only; no hashing.

§Examples

let digest = "pbkdf2_sha256$100000$c2FsdA$aGFzaA";
assert_eq!(ocre::password::iterations(digest), Some(100_000));
assert_eq!(ocre::password::iterations("$2b$12$bcrypt"), None);