1.0.0 • Published 4 years ago

hmac-cli v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

HMAC-CLI

Simple Node.js HMAC Command Line Utility

Quickly create and verify hashed message authentication codes

Generate HMAC

$ export HMAC_SECRET=MY_SECRET_KEY
$ npx hmac-cli generate 'Message to Hash'

36a2f1cb3e77384f5d98dac34e501d9367570408d2b5fb7519808c34443dc3a6

Verify HMAC

$ node verify 'Message to Hash' -e 36a2f1cb3e77384f5d98dac34e501d9367570408d2b5fb7519808c34443dc3a6

Success: Given HMAC string matches the generated!

Installation (optional)

$ npm i -g hmac-cli

then use the global hmac command:

hmac generate 'Message to Hash' -s MY_SECRET_KEY

More example usages

Get help:

$ npx hmac-cli --help

Usage: hmac [options] [command]

Options:
  -h, --help                    display help for command

Commands:
  generate [options] <content>
  verify [options] <content>
  help [command]                display help for command

or help for specific command:

$ npx hmac-cli help generate

Usage: hmac generate [options] <content>

Options:
  -h, --hash <name>         Name of the hash function (default: "sha256")
  -d, --digest <alhorithm>  Digest algorithm (default: "hex")
  -s, --secret <secret>     HMAC secret string
  --help                    display help for command

Example usage with options:

$ npx hmac-cli generate 'Message to Hash' -h sha512 -d base64 -s YOUR_SECRET
  • Hash can be any hashing algorithm on your current system see crypto docs
  • Encoding can be any valid string encoding

LICENSE

MIT