pub struct TrigraphAnalyzer;Expand description
TrigraphAnalyzer is an analyzer that calculates the strength of a password based on the frequency of trigraphs (sequences of three characters).
It works by counting the occurrences of each trigraph in the password and then calculating the entropy of these frequencies. Higher entropy indicates a more random and thus stronger password.
§Examples
use password_strength::analyzer::trigraph::TrigraphAnalyzer;
use password_strength::analyzer::Analyzer;
let analyzer = TrigraphAnalyzer::default();
let password = "abcdef";
let score = analyzer.analyze(password);
assert!(score > 0.0);
assert!(score <= 1.0);
let password = "password123";
let score = analyzer.analyze(password);
assert!(score > 0.0);
assert!(score <= 1.0);
let password = "1234567890";
let score = analyzer.analyze(password);
assert!(score > 0.0);
assert!(score <= 1.0);
let password = "!@#$%^&*()";
let score = analyzer.analyze(password);
assert!(score > 0.0);
assert!(score <= 1.0);
let password = "ab";
let score = analyzer.analyze(password);
assert_eq!(score, 0.0);Trait Implementations§
Source§impl Analyzer for TrigraphAnalyzer
impl Analyzer for TrigraphAnalyzer
Source§impl Default for TrigraphAnalyzer
impl Default for TrigraphAnalyzer
Source§fn default() -> TrigraphAnalyzer
fn default() -> TrigraphAnalyzer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TrigraphAnalyzer
impl RefUnwindSafe for TrigraphAnalyzer
impl Send for TrigraphAnalyzer
impl Sync for TrigraphAnalyzer
impl Unpin for TrigraphAnalyzer
impl UnsafeUnpin for TrigraphAnalyzer
impl UnwindSafe for TrigraphAnalyzer
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