Skip to content

dcu/hmac-signature

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

hmac-signature

HMAC Signature example

Configuring go

Install go runtime. On Mac type:

brew install go

On Ubuntu/Debian type:

sudo apt-get install golang

Set the $GOPATH:

export GOPATH=~/GO
mkdir -p $GOPATH
export PATH=$GOPATH/bin:$PATH

Installation

Using go get

go get github.com/dcu/hmac-signature

Using git clone

git clone https://github.com/dcu/hmac-signature
cd hmac-signature
go build hmac-signature.go

Usage

hmac-signature -key="<a key>" -url="<url>" -nonce="<optional nonce>" -params="<param list>"

For example:

$ hmac-signature -key="key" -url="example.com/path" -nonce="123" -params="c=3 b=2 a=1"
URL: example.com/path
Params: a=1&b=2&c=3
Nonce: 123
Data: 123example.com/patha=1&b=2&c=3

Signature: R3DT7W9IGZjiRAip9LJTLbEzX981JZfZpd7/gmt8BNU=
Nonce: 123

if the nonce is not provided, one is generated automatically:

$ hmac-signature -key="key" -url="example.com/path" -params="c=3 b=2 a=1"
URL: example.com/path
Params: a=1&b=2&c=3
Nonce: 1427897981316727363
Data: 1427897981316727363example.com/patha=1&b=2&c=3

Signature: GiegYK7oTBjSDSzo7/wZ2V0BHasXj313/4N4FV+DsLI=
Nonce: 1427897981316727363

Algorithm

You can follow the code and comments here

About

HMAC signature example

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages