Hash strings from the command line using MD5, SHA-1, SHA-256, or SHA-512. Zero dependencies. Works on Windows, macOS, and Linux.
Need a quick hash of a string? You could write a one-liner in Python or pipe through shasum — but the syntax is different on every platform, and you always forget the flags.
string-hash-cli gives you one command that works everywhere:
npx @kszongic/string-hash-cli "hello world"
# b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9No Python. No platform-specific flags. Just the hash.
npm install -g @kszongic/string-hash-cliOr run directly without installing:
npx @kszongic/string-hash-cli "hello world"string-hash "hello world"
# b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9# MD5
string-hash -a md5 "test"
# 098f6bcd4621d373cade4e832627b4f6
# SHA-1
string-hash -a sha1 "data"
# a17c9aaa61e80a1bf71d0d850af4e5baa9800bbd
# SHA-512
string-hash -a sha512 "secret"
# bd2b1aaf7ef4f09be9f52ce2d8d599674d81aa9d6a4421696dc4d93dd0619d68...string-hash -a sha1 -e base64 "data"
# o6a370tOtOSMzGKHmdY9Hxp+sDY=string-hash "one" "two" "three"
# 7692c3ad... one
# 3fc4ccfe... two
# 8b5b9db0... threeecho -n "secret" | string-hash -a sha512
# Pipe file contents
cat config.json | string-hash -a sha256
# Use in scripts
TOKEN_HASH=$(echo -n "$API_TOKEN" | string-hash)| Flag | Description | Default |
|---|---|---|
-a, --algorithm <alg> |
md5, sha1, sha256, sha512 |
sha256 |
-e, --encoding <enc> |
hex, base64 |
hex |
-h, --help |
Show help | |
-v, --version |
Show version |
- Verify data integrity — Quick hash to compare strings or file contents
- API development — Generate hashes for webhook signatures
- Password hashing demos — Show how different algorithms produce different outputs
- CI/CD pipelines — Hash config values for cache keys or artifact naming
- Shell scripts — Portable hashing without platform-specific
sha256sum/shasum/certutildifferences - Quick checksums — Pipe any input through stdin for an instant hash
| Feature | string-hash-cli | shasum (Unix) |
certutil (Win) |
openssl dgst |
Python one-liner |
|---|---|---|---|---|---|
| Cross-platform | ✅ | ❌ Unix only | ❌ Windows only | ||
| Zero dependencies | ✅ | N/A | N/A | ❌ | ❌ |
| Multiple algorithms | ✅ md5/sha1/256/512 | ✅ | ✅ | ✅ | |
| Multiple strings | ✅ One command | ❌ | ❌ | ❌ | ❌ |
| Base64 output | ✅ | ❌ | ❌ | ✅ | ✅ |
| Stdin support | ✅ | ✅ | ❌ | ✅ | ✅ |
| Memorable syntax | ✅ | ❌ | ❌ | ❌ | ❌ |
Uses Node.js built-in crypto module — no external dependencies. The entire tool is a thin CLI wrapper around crypto.createHash(), so you get the same battle-tested OpenSSL implementations under the hood.
- checksum-verify-cli — Verify file checksums
- env-lint-cli — Lint .env files against .env.example
- kill-port-cli — Find and kill processes by port