Cryptirust
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.
Quick start
1. Create a Default Generator
The default generator uses the EFF wordlist as a base for training the markov model which generates secure and easy-to-remember passphrases.
use Generator;
2. Generate a Password from a Custom Pattern
Use a pattern string to create complex passwords:
w: Lowercase pseudo-word.W: Uppercase pseudo-word.c: Lowercase character.C: Uppercase character.s: Symbol.d: Digit.\: Escape next character.
use Generator;
3. Generate a Passphrase with Custom Depth
use Generator;
Command Line Interface is included with the library
This CLI allows users to specify a pattern for the generated passphrases and the number of passphrases to generate. The default pattern is "www", and it generates a single passphrase if no arguments are provided.
Usage
To run the CLI, first cargo install cryptirust, then use the following command:
- PATTERN: A string representing the desired structure of the generated
passphrases, default is
w-c-s-d(i.e. word-character-symbol-digit). - NUM: The number of passphrases to generate. Must be a positive integer.
Default is
5.
Examples
Generate one passphrase with the default pattern:
Generate five passphrases with a custom pattern:
License
Cryptirust is licensed under the MIT License.