| Crates.io | rpg-util |
| lib.rs | rpg-util |
| version | 1.1.1 |
| created_at | 2025-11-29 16:33:36.56488+00 |
| updated_at | 2026-01-16 14:07:05.779251+00 |
| description | Rust Password Generator - A fast and customizable password generator |
| homepage | |
| repository | https://github.com/robot-accomplice/rpg |
| max_upload_size | |
| id | 1956956 |
| size | 118,476 |
: .:
.% -#
..:... =%*+*- .*#*#*:: . . -++.
-==+++*****###***+=++==++*%@@@@#+++++++++##%%%%***++++++++++=++====+=++++++%@.
:-=++*##%%@@@@@%%##**+==+++==+==#%@%%%%#+**++**#######*****+========+==+*%%@#
.:::::. -::%###: .*#- .::
..*###. :#%-
.#%* .=+.
:#%#
:::
A fast, secure, and customizable command-line password generator written in Rust.
LLLNNNSSS for 3 lowercase, 3 numeric, 3 symbols)cargo install rpg-util
git clone https://github.com/robot-accomplice/rpg.git
cd rpg
cargo build --release
The binary will be available at target/release/rpg.
Generate 5 passwords with default settings (16 characters, all character types):
rpg 5
-l, --length <LENGTH>: Set password length (default: 16, max: 10,000)-c, --capitals-off: Disable capital letters-n, --numerals-off: Disable numerals-s, --symbols-off: Disable symbols-e, --exclude-chars <CHARS>: Exclude specific characters or ranges (e.g., a-z, 0-9)--include-chars <CHARS>: Include only specific characters or ranges (overrides type flags)--min-capitals <N>: Minimum number of capital letters required--min-numerals <N>: Minimum number of numerals required--min-symbols <N>: Minimum number of symbols required-t, --table: Display passwords in table format-q, --quiet: Suppress banner and header output--seed <SEED>: Seed for reproducible password generation--format <FORMAT>: Output format: "text" (default) or "json"--copy: Copy first password to clipboard--pattern <PATTERN>: Generate passwords from a pattern (L=lowercase, U=uppercase, N=numeric, S=symbol)Generate 10 passwords of length 20:
rpg 10 --length 20
Generate 5 passwords without capital letters:
rpg 5 --capitals-off
Generate 5 passwords with only alphabetic characters:
rpg 5 --numerals-off --symbols-off
Generate 5 passwords excluding specific characters or ranges:
rpg 5 --exclude-chars a-z # Exclude all lowercase letters
rpg 5 --exclude-chars 0-9 # Exclude all digits
rpg 5 --exclude-chars a-z,0-9 # Exclude ranges and individual chars
rpg 5 --exclude-chars a,b,c # Exclude individual characters
rpg 5 --exclude-chars a-c,x,0-2 # Mix of ranges and individual chars
Display passwords in table format:
rpg 10 --table
Generate passwords with custom length and character restrictions:
rpg 8 --length 24 --capitals-off --exclude-chars 0,O,1,l
Generate passwords with minimum requirements:
rpg 5 --length 20 --min-capitals 2 --min-numerals 3 --min-symbols 1
Generate reproducible passwords with seed:
rpg 5 --seed 12345
Output in JSON format:
rpg 3 --format json
Copy first password to clipboard:
rpg 1 --copy
Use only specific characters:
rpg 5 --include-chars a-z,0-9
Generate passwords from a pattern:
rpg 5 --pattern "LLLNNNSSS" # 3 lowercase, 3 numeric, 3 symbols
rpg 5 --pattern "UUUlllnnn" # 3 uppercase, 3 lowercase, 3 numeric
The generator uses the following character ranges:
a-z (always included)A-Z (can be disabled with --capitals-off)0-9 (can be disabled with --numerals-off)--symbols-off)
!"#$%&'()*+,-./ (33-47):;<=>?@ (58-64){|}~ (123-126)The generator validates inputs and provides clear error messages:
RPG can also be used as a library in your Rust projects:
[dependencies]
rpg-util = "1.1.0"
use rpg_util::{GenerationParams, PasswordArgs, build_char_set, generate_passwords, parse_pattern};
use rand::Rng;
let args = PasswordArgs {
capitals_off: false,
numerals_off: false,
symbols_off: false,
exclude_chars: vec![],
include_chars: None,
min_capitals: None,
min_numerals: None,
min_symbols: None,
pattern: None,
length: 16,
password_count: 1,
};
let char_set = build_char_set(&args)?;
let mut rng = rand::rng();
let gen_params = GenerationParams {
length: 16,
count: 1,
min_capitals: None,
min_numerals: None,
min_symbols: None,
pattern: None,
};
let passwords = generate_passwords(&char_set, &gen_params, &mut rng);
// Or use pattern-based generation
let pattern = parse_pattern("LLLNNNSSS")?;
let gen_params = GenerationParams {
length: 9,
count: 1,
min_capitals: None,
min_numerals: None,
min_symbols: None,
pattern: Some(pattern),
};
let passwords = generate_passwords(&char_set, &gen_params, &mut rng);
Run the test suite:
# Run all tests
cargo test
# Run only unit tests
cargo test --lib
# Run only integration tests
cargo test --test integration_test
# Run with output
cargo test -- --nocapture
Run performance benchmarks:
cargo bench
This will generate HTML reports in target/criterion/.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
cargo testcargo clippycargo fmtOptional pre-commit hooks are available to ensure code quality. See PRE_COMMIT_HOOKS.md for detailed documentation.
Quick setup:
pip install pre-commit
pre-commit install
This will run formatting, linting, and tests before each commit.