pwgen.cr v0.0.1

pwgen

build Lines of Code

Password generator written in Crystal. Port of the C pwgen utility.

Build

shards build --release

Binary: bin/pwgen

Usage

pwgen [length] [count]

Generate 5 passwords of 12 characters:

pwgen 12 5

Options:

  -c, --capitalize          Include at least one capital letter
  -A, --no-capitalize       Don't include capital letters
  -n, --numerals            Include at least one number
  -0, --no-numerals         Don't include numbers
  -y, --symbols             Include at least one special symbol
  -B, --ambiguous           Don't include ambiguous characters
  -v, --no-vowels           Don't include vowels
  -r, --remove-chars CHARS  Remove given characters
  -s, --secure              Generate completely random passwords
  -C                        Print the generated passwords in columns
  -1                        Don't print the generated passwords in columns
  -N, --num-passwords NUM   Number of passwords to generate
  -H, --sha1 FILE[#seed]    Use sha1 hash of given file
  -h, --help                Print this help message
  -V, --version             Print version

Examples

Random passwords:

pwgen -s 16 3

No ambiguous characters:

pwgen -B 12

Include symbols:

pwgen -y 14 3

Deterministic generation:

pwgen -H /path/to/file#seed 12 5

Implementation

  • Default: phoneme-based pronounceable passwords
  • -s: cryptographically secure random (Random::Secure)
  • -H: SHA1-based PRNG for reproducible output
  • Uses Crystal's Random::Secure backed by the OS CSPRNG

Tests

crystal spec

Acknowledgements

This project is a Crystal port of the original C pwgen utility by Theodore Ts'o. The original implementation and design are available at: https://github.com/tytso/pwgen

License

MIT

Repository

pwgen.cr

Owner
Statistic
  • 0
  • 0
  • 1
  • 0
  • 0
  • about 2 hours ago
  • December 11, 2025
License

MIT License

Links
Synced at

Mon, 15 Dec 2025 20:19:42 GMT

Languages