@kszongic/rand-hex-cli
v1.0.0
Published
Generate random hex strings from the command line — perfect for tokens, keys, and colors
Maintainers
Readme
@kszongic/rand-hex-cli
Generate random hex strings from the command line — perfect for tokens, keys, and colors.
Zero dependencies. Uses Node.js built-in crypto.randomBytes for cryptographically secure output.
Install
npm i -g @kszongic/rand-hex-cliUsage
# Default: 32-char hex string
rand-hex
# a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6
# Custom length
rand-hex 8
# f3a1b2c4
# Multiple strings
rand-hex 16 -n 5
# Uppercase with 0x prefix
rand-hex 6 --upper --prefix
# 0xF3A1B2Options
| Flag | Description |
|------|-------------|
| [length] | Number of hex characters (default: 32) |
| -n, --count | Number of strings to generate |
| -u, --upper | Uppercase output |
| -p, --prefix | Add 0x prefix |
| -h, --help | Show help |
| -v, --version | Show version |
Use Cases
- Generate API tokens and secrets
- Create random color codes (
rand-hex 6 -p) - Seed test data
- Quick nonce/salt generation
License
MIT © 2026 kszongic
