Skip to content

πŸ›‘οΈ Secure, offline-friendly password generator in Rust. Flexible CLI & interactive modes, entropy calculation, strong charset options, and modular design.

License

Notifications You must be signed in to change notification settings

ftokarek/Rust-Password-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Rust Password Generator

A secure, flexible, and user-friendly password generator written in Rust.
This tool allows you to generate strong, random passwords with customizable options, calculate their entropy, and assess their strength.


✨ Features

  • Interactive mode: Answer prompts in your terminal to generate passwords step by step.
  • Command-line mode: Use CLI arguments for quick, scriptable password generation.
  • Customizable character sets: Choose lowercase, uppercase, digits, symbols, or any combination.
  • Multiple password generation: Generate one or many passwords at once.
  • Entropy calculation: See the entropy and strength classification for each password.
  • Modular codebase: Easy to extend and maintain.

πŸš€ Getting Started

Prerequisites

  • Rust (edition 2021 or newer)

Build & Run

Clone the repository and build the project:

git clone https://github.com/yourusername/rust-password-generator.git
cd rust-password-generator
cargo build --release

πŸ› οΈ Usage

πŸ–₯️ Interactive Mode

Simply run:

cargo run

You will be prompted for:

  • Password length
  • Number of passwords to generate
  • Whether to include lowercase, uppercase, digits, and symbols

Example session:

rust-password-generator - Secure password generator CLI
(Interactive mode)
Enter password length (default 16): 20
Enter number of passwords to generate (default 1): 2
Include character sets? (y/n, default: y)
Lowercase letters? y
Uppercase letters? y
Digits? y
Symbols? n

Pass 1:
yQw8z2Xv9pLm4sRt1uIo

Pass 2:
aB3dE5fG7hJ9kL1mN2pQ

Password 1: entropy = 94.60 bits (Strong)
Password 2: entropy = 94.60 bits (Strong)

⚑ Command-Line Mode

You can also generate passwords directly using CLI arguments:

cargo run -- --length 20 --symbols --count 3

Available options:

  • --length <LENGTH>: Length of each password (default: 16)
  • --lowercase / --no-lowercase: Include/exclude lowercase letters (default: include)
  • --uppercase / --no-uppercase: Include/exclude uppercase letters (default: include)
  • --digits / --no-digits: Include/exclude digits (default: include)
  • --symbols / --no-symbols: Include/exclude symbols (default: exclude)
  • --count <COUNT>: Number of passwords to generate (default: 1)

Example:

cargo run -- --length 12 --no-symbols --count 2

πŸ“Š Entropy Calculation

For each generated password, the program calculates its entropy using the formula:

entropy = password_length Γ— log2(charset_size)
  • password_length: Number of characters in the password
  • charset_size: Number of unique characters available for generation

Strength classification:

  • πŸŸ₯ Weak: < 40 bits
  • 🟨 Medium: 40–60 bits
  • 🟩 Strong: > 60 bits

πŸ“ Example Output

Pass 1:
A1b2C3d4E5f6

Pass 2:
G7h8I9j0K1l2

Password 1: entropy = 71.51 bits (Strong)
Password 2: entropy = 71.51 bits (Strong)

⚠️ Security Notice

  • Generated passwords are displayed in clear text in your terminal.
    Ensure your environment is secure and do not share your screen when generating sensitive passwords.
  • For even greater security, consider adding clipboard support or file output.

πŸ“„ License

This project is licensed under the MIT License.


πŸ‘€ Author

Created by Franciszek Tokarek.

About

πŸ›‘οΈ Secure, offline-friendly password generator in Rust. Flexible CLI & interactive modes, entropy calculation, strong charset options, and modular design.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages