random-words-local
v1.1.0
Published
Generate secure, memorable random word passphrases from a 275,000+ word English dictionary. Perfect for creating strong passwords, passphrases, mnemonic phrases, and diceware-style wordlists. CLI tool with cryptographically secure random generation.
Maintainers
Readme
Random Words CLI - Passphrase Generator
Generate secure, memorable random word passphrases from a 275,000+ word English dictionary.
This CLI tool uses cryptographically secure random numbers (crypto.randomInt) to generate strong, easy-to-remember passphrases perfect for passwords, SSH keys, seed phrases, and security-sensitive applications. Based on the famous XKCD "correct horse battery staple" concept and Diceware method.
Why Random Word Passphrases?
Passphrases generated by this tool are:
- More secure than random character passwords (higher entropy)
- Easier to remember than complex symbol-laden passwords
- Resistant to brute force attacks due to massive keyspace
- Human-friendly for typing and memorization
With 4 words from a ~275,000 word dictionary: ~72 bits of entropy ($4 \times \log_2(275,000)$)
Installation
Run directly with npx (no installation required):
npx random-words-localOr install globally for convenient CLI access:
npm install -g random-words-localThis package now exposes both random-words-local and random-words as CLI commands, so either of these will work after install:
random-words-local
random-wordsUsage
random-words-local [options]Options
| Option | Description | Default |
| :----------------------- | :--------------------------------------------- | :------- |
| -n, --count <number> | Number of words to generate | 4 |
| -s, --separator <char> | Separator between words | - |
| -f, --format <type> | Output format: joined, array, or newline | joined |
| -h, --help | Show help message | |
Examples
Generate a passphrase (default: 4 words)
random-words
# Output: correct-horse-battery-stapleGenerate a stronger passphrase with 6 words
random-words -n 6
# Output: audible-receipt-walnut-tangible-symphony-leverageUse spaces instead of dashes for readability
random-words -n 5 -s " "
# Output: lightning fortress orchestra pioneer cobaltGenerate a passphrase for password managers
random-words -n 4 -s ""
# Output: mushroom.jellyfish.umbrella.pavementOutput as JSON array for scripts
random-words -n 3 -f array
# Output: ["horizon","architect","melody"]One word per line for batch processing
random-words -n 5 -f newline
# horizon
# architect
# melody
# fortress
# lightningUse in scripts with custom separator
random-words -n 8 -s "_"
# Output: purple_tiger_midnight_lighthouse_falcon_sunset_azure_kitchenUse Cases
- Password managers - Generate master passwords or secure notes
- SSH keys - Create memorable passphrase for private keys
- Two-factor authentication - Backup codes or recovery phrases
- Cryptocurrency - Seed phrases and wallet recovery
- API keys - Secure tokens for development
- VPN passwords - Strong, memorable credentials
Security
This tool uses Node.js crypto.randomInt() for cryptographically secure random number generation. Unlike pseudo-random generators, crypto.randomInt is suitable for security-sensitive applications.
The entropy calculation:
- 1 word from 275,000 words ≈ 18 bits
- 4 words ≈ 72 bits
- 6 words ≈ 108 bits
- 8 words ≈ 144 bits
For comparison, a typical 12-character alphanumeric password has ~60 bits of entropy.
Related Projects
- EFF Diceware - The original passphrase method
- XKCD 936 - Password strength comic
- an-array-of-english-words - Word dictionary
License
MIT
