cryptirust

Crates.iocryptirust
lib.rscryptirust
version2.0.2
sourcesrc
created_at2024-10-09 13:14:46.881928
updated_at2024-10-12 12:33:38.092646
descriptionA flexible password generator that creates pronounceable passwords with adjustable entropy and custom patterns.
homepage
repositoryhttps://github.com/francescoalemanno/cryptirust
max_upload_size
id1402376
size163,477
Francesco Alemanno (francescoalemanno)

documentation

https://docs.rs/cryptirust

README

Cryptirust

Crates.io MIT licensed Build Status API Docs

Cryptirust is a flexible and efficient Rust library for generating customizable, pronounceable passwords with entropy calculation. It leverages a Markov chain-based approach through its core Generator struct, allowing you to construct secure passphrases and word-based passwords from predefined or user-defined token lists.

Designed to balance security, usability, and flexibility, Cryptirust offers fine-grained control over the structure and randomness of passwords. Whether you're creating simple, memorable passphrases or complex high-entropy passwords, Cryptirust provides an intuitive API to meet a range of password generation needs.

Key Features

  • Pronounceable Passwords: Create easy-to-pronounce, memorable passwords using phonetic patterns.
  • Entropy Calculation: Automatically calculates and returns the entropy of each generated password, helping you gauge its strength.
  • Custom Token Support: Define custom token sets and adjust the depth of the Markov chain model for even greater control over password structure.
  • Pattern Flexibility: Generate passphrases, pseudo-words, and custom patterns that can include symbols, numbers, and more.
  • CLI: most functions of cryptirust are easily accessible from Crypticli.

Quick start

1. Generate a Password from a Custom Pattern

Use a pattern string to create complex passwords:

  • c: Lowercase token.
  • C: Uppercase token.
  • w: Lowercase word.
  • W: Uppercase word.
  • s: Symbol.
  • d: Digit.
  • \: Escape next character.
use cryptirust::Generator;

fn main() {
    let mut generator = Generator::new();
    let (password, entropy) = generator.gen_from_pattern("cccsd");
    println!("Generated password: {}", password);
    println!("Entropy: {:.2} bits", entropy);
}

2. Generate a Passphrase with Custom Depth

use cryptirust::*;

fn main() {
    let mut generator = Generator::new_custom(word_list::eff::list(), 2).unwrap();
    let (passphrase, entropy) = generator.gen_from_pattern("w.w.w.w");;
    println!("Generated passphrase: {}", passphrase);
    println!("Entropy: {:.2} bits", entropy);
}

License

Cryptirust is licensed under the MIT License.

Commit count: 22

cargo fmt