2 releases
Uses new Rust 2024
| 0.1.1 | Jun 23, 2025 |
|---|---|
| 0.1.0 | Jun 23, 2025 |
#57 in Security
78KB
2K
SLoC
Password Generator CLI Tool
A secure and feature-rich password generator CLI tool built in Rust, specifically designed for macOS.
Features
- 🔐 Secure Password Generation: Uses cryptographically secure random number generation
- 📝 Passphrase Generation: Generate memorable passphrases from word lists
- 🔍 Password Strength Analysis: Check password strength with detailed analysis
- 📋 Clipboard Integration: Copy passwords directly to macOS clipboard
- 🎨 Multiple Output Formats: Plain text, Base64, and Hex encoding
- ⚙️ Customizable Options: Control character sets, length, and exclusions
- 🔒 Hash Generation: Generate SHA256, SHA512, and Base64 hashes
Installation
Method 1: Universal Installer (Recommended)
The easiest way to install on any platform:
curl -fsSL https://raw.githubusercontent.com/morshedulmunna/passgen/main/install-universal.sh | bash
Method 2: Homebrew (macOS)
# Add the tap (if using custom tap)
brew tap morshedulmunna/tap
# Install the tool
brew install passgen
Method 3: Cargo (Rust Package Manager)
cargo install passgen-cli
Method 4: Build from Source
-
Clone or download this repository
-
Navigate to the project directory:
cd passgen -
Build the project:
cargo build --release -
Install globally:
cargo install --path .
Method 5: Manual Installation
-
Download the latest release for your platform from GitHub Releases
-
Extract the archive
-
Move the binary to a directory in your PATH:
# For macOS/Linux sudo mv passgen /usr/local/bin/ # Or for user installation mkdir -p ~/.local/bin mv passgen ~/.local/bin/ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc source ~/.zshrc
Quick Start
After installation, try these commands:
# Generate a secure password
passgen generate --length 16 --copy
# Generate a memorable passphrase
passgen passphrase --words 4
# Check password strength
passgen check "MyPassword123!"
# Generate a hash
passgen hash "my-secret-string" --algorithm sha256
Usage
Generate Passwords
Generate a basic 16-character password:
passgen generate
Generate a 32-character password with specific character sets:
passgen generate --length 32 --uppercase --lowercase --numbers --special
Generate a password and copy to clipboard:
passgen generate --length 20 --copy
Generate a password in Base64 format:
passgen generate --length 16 --format base64
Exclude similar and ambiguous characters:
passgen generate --exclude-similar --exclude-ambiguous
Generate Passphrases
Generate a 4-word passphrase:
passgen passphrase
Generate a 6-word passphrase with numbers and special characters:
passgen passphrase --words 6 --numbers --special
Generate a passphrase with custom separator:
passgen passphrase --separator "-" --copy
Check Password Strength
Analyze a password:
passgen check "MyPassword123!"
Generate Hashes
Generate SHA256 hash:
passgen hash "my-secret-string"
Generate SHA512 hash:
passgen hash "my-secret-string" --algorithm sha512
Generate Base64 encoding:
passgen hash "my-secret-string" --algorithm base64
Command Options
Generate Command
-l, --length <LENGTH>: Password length (default: 16)-u, --uppercase: Include uppercase letters-d, --lowercase: Include lowercase letters-n, --numbers: Include numbers-s, --special: Include special characters--exclude-similar: Exclude similar characters (l, 1, I, O, 0)--exclude-ambiguous: Exclude ambiguous characters-f, --format <FORMAT>: Output format (plain, base64, hex)-c, --copy: Copy to clipboard
Passphrase Command
-w, --words <WORDS>: Number of words (default: 4)--separator <SEPARATOR>: Word separator (default: space)-n, --numbers: Include numbers-s, --special: Include special characters-c, --copy: Copy to clipboard
Check Command
password: Password to analyze
Hash Command
input: Input string to hash-a, --algorithm <ALGORITHM>: Hash algorithm (sha256, sha512, base64)
Examples
Strong Password for Online Banking
passgen generate --length 24 --uppercase --lowercase --numbers --special --exclude-similar --copy
Memorable Passphrase for Personal Use
passgen passphrase --words 5 --numbers --special --copy
Quick Password Check
passgen check "password123"
Generate API Key Hash
passgen hash "my-api-key" --algorithm sha256
Security Features
- Cryptographically Secure: Uses
OsRngfor true randomness - Entropy Calculation: Measures password strength in bits
- Character Set Control: Fine-grained control over character types
- Pattern Detection: Identifies common weak patterns
- Exclusion Options: Avoid confusing or problematic characters
Password Strength Levels
- Very Weak: < 20 bits entropy
- Weak: 20-30 bits entropy
- Medium: 30-40 bits entropy
- Strong: 40-50 bits entropy
- Very Strong: > 50 bits entropy
Platform Support
- ✅ macOS (Intel & Apple Silicon)
- ✅ Linux (x86_64 & ARM64)
- ✅ Windows (x86_64)
Troubleshooting
Clipboard Issues on macOS
If clipboard functionality doesn't work:
- Go to System Preferences > Security & Privacy > Privacy > Accessibility
- Click the lock icon to make changes
- Add your terminal application (Terminal, iTerm2, etc.)
- Restart your terminal
Installation Issues
If you encounter installation problems:
- Ensure you have the latest version of Rust installed
- Try the universal installer:
curl -fsSL https://raw.githubusercontent.com/morshedulmunna/passgen/main/install-universal.sh | bash - Check the GitHub Issues for known problems
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Disclaimer
This tool is provided for educational and personal use. Always follow your organization's password policies and security guidelines. The authors are not responsible for any security issues arising from the use of this tool.
Dependencies
~19–36MB
~554K SLoC