6 releases

0.1.6 Jun 7, 2024
0.1.5 Apr 14, 2024

#65 in Authentication

Download history 297/week @ 2024-04-08 85/week @ 2024-04-15 8/week @ 2024-05-20 135/week @ 2024-06-03 8/week @ 2024-06-10

151 downloads per month

MIT license

297 lines

npwg - Secure Password Generator

npwg is a secure password generator written in Rust. With npwg, you can easily generate strong and random passwords to protect your online accounts.


  • Generate passwords with custom length
  • Support various character sets (digits, lowercase letters, uppercase letters, symbols)
  • Allow excluding specific characters
  • Allow forcing the inclusion of specific characters
  • Generate multiple passwords at once
  • Display statistics about the generated passwords


Using Cargo

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.

Manual Installation

  1. Make sure you have Rust installed on your system. If not, you can download it from the official Rust website: https://www.rust-lang.org/tools/install

  2. Clone this repository:

git clone https://github.com/vschwaberow/npwg.git
  1. Navigate to the project directory:
cd npwg
  1. Build the project:
cargo build --release
  1. The executable can be found at target/release/npwg.




  • -l, --length <usize>: Set the length of the password (default: 8)
  • -a, --allowed <STRING>: Set the allowed character sets (comma-separated) [default: digit,lowerletter,upperletter,symbol1,symbol2]
  • -e, --exclude <STRING>: Exclude specific characters (comma-separated)
  • -i, --include <STRING>: Force the inclusion of specific characters (comma-separated)
  • -n, --num <usize>: Set the number of passwords to generate (default: 1)
  • -s, --stats: Display statistics about the generated passwords
  • -h, --help: Display the help information
  • -V, --version: Display the version information


Generate a password with the default length (8 characters):

npwg -l 12

Generate a password that includes only digits and lowercase letters:

npwg -a digit,lowerletter

Generate a password that excludes specific characters:

npwg -e 0,O,l

Generate a password that forces the inclusion of specific characters:

npwg -i 1,2,3

Generate 5 passwords at once:

npwg -n 5

Generate a password with a custom length and character sets:

npwg -l 16 -a digit,lowerletter,upperletter,symbol1,symbol2

Display statistics about the generated password:

npwg -s


Contributions are welcome! If you find a bug or have a suggestion for improvement, please open an issue or submit a pull request.


This project is licensed under the MIT License.


~188K SLoC