/hmac-cli

Simple Command Line HMAC Utility

Primary LanguageJavaScript

HMAC-CLI

Simple Node.js HMAC Command Line Utility

I made this to quickly create and verify hashed message authentication codes

Installation

$ git clone git@github.com:thinaire/hmac-cli.git
$ cd hmac-cli

Create HMAC

hmac-cli$ export CONTENT_HMAC=MY_SECRET_KEY
hmac-cli$ node hmac 'Message to Hash'

HMAC:
NqLxyz53OE9dmNrDTlAdk2dXBAjStft1GYCMNEQ9w6Y=

Verify HMAC

hmac-cli$ node verify 'Message to Hash' NqLxyz53OE9dmNrDTlAdk2dXBAjStft1GYCMNEQ9w6Y=


Message is Valid


More Useage

Run without any parameters (or erroneous ones) to see useage:

hmac-cli$ node hmac

Usage: node hmac [MESSAGE] [HASH] [ENCODING]

SECRET should be in the CONTENT_HMAC environment variable. `export CONTENT_HMAC=YOUR_SECRET`
HASH defaults to `sha256`.
ENCODING defaults to `base64`.

hmac-cli$ node verify

Usage: node verify-hmac [MESSAGE] [HMAC] [HASH] [ENCODING]

SECRET should be in the CONTENT_HMAC environment variable. `export CONTENT_HMAC=YOUR_SECRET`
HASH defaults to `sha256`.
ENCODING defaults to `base64`.

  • Hash can be any hashing algorithm on your current system see crypto docs
  • Encoding can be any valid string encoding

LICENSE

MIT