4 stable releases

1.0.3 Apr 3, 2022

#879 in Authentication

MIT/Apache

17KB
333 lines

Crates.io Crates.io License License made-with-rust Build Status

libpassgen

Crate to generate pseudo-random passwords.
This is the Passgen core. A cli app to generate passwords.

USAGE

Generate a 15 chars password with the given "pool" :

use libpassgen::*;

fn main() {
let mut pool = Pool::new();
pool.extend_from_string("123456789");
let password = generate_password(&pool, 15);
println!("{}",password);
}

Generate 100 passwords with 15 chars with the given "pool" :

use std::str::FromStr;
use libpassgen::*;

fn main() {
let mut pool = Pool::from_str("1234567").unwrap();
let vec_passwords = generate_n_passwords(&pool, 15, 100);
for n in 0..vec_passwords.len() {
    println!("{}",vec_passwords[n]);
	}
}

Have a look to Passgen cli app for full example.

Dependencies

~1.5MB
~26K SLoC