| Crates.io | npwg |
| lib.rs | npwg |
| version | 0.4.6 |
| created_at | 2024-04-12 09:37:41.528793+00 |
| updated_at | 2025-09-22 15:20:19.719847+00 |
| description | Securely generate random passwords |
| homepage | |
| repository | https://github.com/vschwaberow/npwg |
| max_upload_size | |
| id | 1206148 |
| size | 193,627 |
npwg is a secure password generator written in Rust. With npwg, you can easily generate strong and random passwords or passphrases to protect your online accounts.
If you have Rust and Cargo installed, you can install npwg using the following command:
cargo install npwg
This will download and compile the latest version of npwg and install it in your Cargo binary directory.
git clone https://github.com/vschwaberow/npwg.git
cd npwg
cargo build --release
target/release/npwg.npwg [OPTIONS]
-l, --length <LENGTH>: Sets the length of the password [default: 16]-c, --count <COUNT>: Sets the number of passwords to generate [default: 1]--avoid-repeating: Avoid repeating characters in the password--stats: Show statistics about the generated passwords--strength: Show strength meter for the generated passwords-a, --allowed <CHARS>: Sets the allowed characters [default: allprint]--use-words: Use words instead of characters-i, --interactive: Start interactive console mode--separator <SEPARATOR>: Sets the separator for diceware passphrases (single character or 'random')--pronounceable: Generate pronounceable passwords--mutate: Mutate the passwords--mutation-type <TYPE>: Type of mutation to apply [default: replace]--mutation-strength <STRENGTH>: Strength of mutation [default: 1]--lengthen <INCREASE>: Increase the length of passwords during mutation--copy: Copy the generated password to the clipboard-h, --help: Print help-V, --version: Print versionsymbol1, symbol2, symbol3: Different sets of symbolsdigit: Numeric digitslowerletter: Lowercase lettersupperletter: Uppercase lettersshell: Shell-safe charactershomoglyph1 to homoglyph8: Various homoglyph setsslashes, brackets, punctuation: Specific character typesall, allprint, allprintnoquote, etc.: Various combinations of character typesGenerate default credentials:
npwg
Specify length, count, and character sets:
npwg --length 20 --count 3 --allowed upperletter,lowerletter,digit
Inspect entropy and statistics in one pass:
npwg --strength --stats
Copy freshly generated secrets to the clipboard:
npwg --copy
First run downloads and verifies the EFF wordlist automatically. Generate six-word phrases separated by spaces:
npwg --use-words --length 6
Customise separators or request random punctuation between words:
npwg --use-words --separator "-" --length 5
npwg --use-words --separator random --length 7
Create pronounceable strings that alternate consonants and vowels:
npwg --pronounceable --length 10
Enforce structural patterns (L=letter, D=digit, S=symbol):
npwg --pattern LLDDS --length 16
Tweak existing passwords by applying deterministic mutations and optional lengthening:
npwg --mutate --mutation-type swap --mutation-strength 2 --lengthen 3
Use interactive mode for guided generation and mutation prompts:
npwg --interactive
Create a config.toml in ~/.config/npwg/ (or ~/.npwg/ on systems without XDG directories) to store defaults and reusable profiles:
[defaults]
length = 20
allowed = "upperletter,lowerletter,digit"
[profiles.work]
count = 5
use_words = true
separator = "-"
Invoke a profile at runtime:
npwg --profile work
Provide a custom config path when needed:
npwg --config ./fixtures/npwg.toml --profile personal
Use built-in policies for common compliance regimes; these enforce minimum length and character-set expectations before applying your overrides:
npwg --policy windows-ad
npwg --policy pci-dss --count 10
Contributions are welcome! If you find a bug or have a suggestion for improvement, please open an issue or submit a pull request.
When contributing Rust code, include only the SPDX license header at the top of each *.rs file—avoid additional inline or block comments elsewhere.
This project is licensed under the MIT License.