A cryptographically secure password generator that provides high-entropy passwords with configurable requirements. Uses platform-native cryptographic APIs (BCrypt on Windows, Security framework on macOS, OpenSSL+getrandom on Linux) for secure random number generation.
- Uses cryptographically secure random number generation (CSPRNG)
- Implements rejection sampling to eliminate modulo bias
- Enforces minimum character type requirements
- Uses Fisher-Yates shuffle for uniform distribution
- Securely clears sensitive data from memory
- Platform-specific secure random number generation
- Configurable password requirements
- Entropy pool for efficient random number generation
- MinGW-w64 or Microsoft Visual C++
- Windows SDK (for BCrypt)
- Xcode Command Line Tools
- Apple Security Framework (included in macOS)
- GCC or Clang
- OpenSSL development libraries
- Ubuntu/Debian:
sudo apt-get install libssl-dev - Fedora:
sudo dnf install openssl-devel - Arch:
sudo pacman -S openssl
- Ubuntu/Debian:
gcc password.c -o password.exe -lbcryptcl password.c bcrypt.lib# For both Intel and Apple Silicon
gcc password.c -o password -framework Securitygcc password.c -o password -lcrypto./password <length>Example:
./password 16This will generate a password of specified length (minimum 12 characters) that includes:
- At least one uppercase letter
- At least one lowercase letter
- At least one number
- At least one special character
You can modify the following defines in password.c:
#define MAX_PASSWORD_LENGTH 128
#define MIN_PASSWORD_LENGTH 12
#define ENTROPY_MULTIPLIER 2Password requirements can be adjusted by modifying the PasswordRequirements struct initialization in main().
- The generated passwords are intended for use as user credentials and should be treated as sensitive data.
- The program securely clears sensitive data from memory after use.
- The random number generation uses platform-specific cryptographic APIs.
- The program enforces a minimum password length of 12 characters for security.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
SecurePassGen/
├── .gitignore
├── LICENSE
├── README.md
├── password.c
└── tests/
└── test_password.c # TODO: Add unit tests
- Add unit tests
- Add CLI options for customizing password requirements
- Add password strength estimation
- Add option to generate multiple passwords
- Add option to exclude similar-looking characters