22 releases

0.3.7 Nov 16, 2024
0.3.6 Oct 11, 2024
0.3.3 Sep 23, 2024
0.2.7 Aug 31, 2024
0.1.5 Apr 14, 2024

#190 in Authentication

Download history 134/week @ 2024-08-12 285/week @ 2024-08-19 149/week @ 2024-08-26 176/week @ 2024-09-02 340/week @ 2024-09-09 161/week @ 2024-09-16 191/week @ 2024-09-23 181/week @ 2024-09-30 338/week @ 2024-10-07 37/week @ 2024-10-14 85/week @ 2024-11-11 28/week @ 2024-11-18

113 downloads per month

MIT license

55KB
1.5K SLoC

npwg - Secure Password Generator

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.

Features

  • Generate passwords with custom length and count
  • Support various defined character sets
  • Generate diceware passwords
  • Generate pronounceable passwords
  • Customizable password length, count, character sets, and separators
  • Avoid repeating characters in passwords
  • Display statistics about the generated passwords
  • Show the estimated strength of the generated passwords
  • Interactive mode for easy password generation

Installation

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
    
  3. Navigate to the project directory:
    cd npwg
    
  4. Build the project:
    cargo build --release
    
  5. The executable can be found at target/release/npwg.

Usage

npwg [OPTIONS]

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 version

Predefined Character Sets

  • symbol1, symbol2, symbol3: Different sets of symbols
  • digit: Numeric digits
  • lowerletter: Lowercase letters
  • upperletter: Uppercase letters
  • shell: Shell-safe characters
  • homoglyph1 to homoglyph8: Various homoglyph sets
  • slashes, brackets, punctuation: Specific character types
  • all, allprint, allprintnoquote, etc.: Various combinations of character types

Examples

Use the interactive mode

npwg -i

or

npwg --interactive

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

npwg

Generate a password with a specific length:

npwg -l 12

Generate multiple passwords:

npwg -c 5

Generate a password using only uppercase and lowercase letters:

npwg -a upperletter,lowerletter

Generate a diceware passphrase:

npwg --use-words -l 6

Generate a diceware passphrase with a custom separator:

npwg --use-words --separator "-" -l 6

Generate a diceware passphrase with random separators:

npwg --use-words --separator random -l 6

Generate a pronounceable password:

npwg --pronounceable

Generate a password and display statistics:

npwg --stats

Generate a password and display the estimated strength:

npwg --strength

Generate a password using the Diceware method. If no diceware wordlist is in ~/.npwg, it will be automatically downloaded from the EFF website:

npwg -d

Generate a password using the Diceware method with a custom number of words. The default number of words is 6. The wordlist will be downloaded if it is not found in ~/.npwg:

npwg -d -w 8

Generate a diceware passphrase with a custom separator:

npwg --use-words --separator "-" -l 6

Generate a diceware passphrase with random separators:

npwg --use-words --separator random -l 6

Mutate an existing password:

npwg --mutate --mutation-type replace --mutation-strength 3

Generate a password and copy it to the clipboard:

npwg --copy

Contributing

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

License

This project is licensed under the MIT License.

Dependencies

~13–30MB
~470K SLoC