A secure, cryptographically-random password generator CLI tool. assGen generates strong passwords with customizable character sets and includes clipboard support with automatic clearing for enhanced security.
PassGen is a command-line password generator that prioritizes security and flexibility. Key features include:
- Cryptographically secure random generation using
crypto/rand - Configurable character sets (lowercase, uppercase, digits, symbols)
- Character type guarantee - ensures at least one character from each enabled type
- Secure clipboard integration with automatic timeout clearing
- Comprehensive validation with length limits (4-256 characters)
- Detailed logging with metadata-only auditing (no passwords logged)
- Secure Randomness: Uses
crypto/randfor all random number generation, ensuring cryptographically secure randomness - Fisher-Yates Shuffle: Implements a secure shuffle algorithm with
crypto/randfor password randomization
- Automatic Clearing: When using
--copy, passwords are automatically cleared from the clipboard after 60 seconds - Secure Implementation: Uses well-established clipboard libraries with proper error handling
- Go 1.17 or later
- Git
# Build the binary
make build
# Run the binary
make run# Generate a 16-character password with all character types (default)
./passgen
# Generate a 32-character password for high-security applications
./passgen --length 32# Generate password without symbols
./passgen --no-symbols
# Generate password with only lowercase letters and digits
./passgen --no-symbols --no-uppercase
# Generate password with only lowercase letters (minimum complexity)
./passgen --no-symbols --no-digits --no-uppercase
# Generate password without digits (letters and symbols only)
./passgen --no-digits# Generate password and copy to clipboard (auto-clears after 60 seconds)
./passgen --copy
# Generate 20-character password and copy to clipboard
./passgen --length 20 --copy
# Generate password without symbols and copy to clipboard
./passgen --no-symbols --copy| Flag | Description | Default |
|---|---|---|
--length |
Password length (4-256 characters) | 16 |
--no-uppercase |
Disable uppercase letters | false |
--no-digits |
Disable digits | false |
--no-symbols |
Disable symbols | false |
--copy |
Copy to clipboard and clear after 60 seconds | false |
- Lowercase:
abcdefghijklmnopqrstuvwxyz - Uppercase:
ABCDEFGHIJKLMNOPQRSTUVWXYZ - Digits:
0123456789 - Symbols:
!@#$%^&*()_+-=[]{}|;:,.<>?
- Use Adequate Length: Generate passwords of at least 12 characters for general use, 20+ for sensitive applications
- Include All Character Types: Use all character types for maximum entropy unless constrained by system requirements
- Leverage Clipboard Feature: Use
--copyfor sensitive environments to avoid passwords remaining in terminal history - Regular Rotation: Generate new passwords regularly for critical systems
- Avoid Reuse: Generate unique passwords for each service or application
PassGen includes comprehensive test coverage:
- Unit Tests: Edge cases, error conditions, and complexity guarantees
- Benchmark Tests: Performance measurement and regression detection
- Integration Tests: CLI functionality and end-to-end validation
Run tests with:
# Run all tests
make testLicensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.