The Go Programming Language

Package hmac

import "crypto/hmac"

Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as defined in U.S. Federal Information Processing Standards Publication 198. An HMAC is a cryptographic hash that uses a key to sign a message. The receiver verifies the hash by recomputing it using the same key.

Package files

hmac.go

func New

func New(h func() hash.Hash, key []byte) hash.Hash

New returns a new HMAC hash using the given hash generator and key.

func NewMD5

func NewMD5(key []byte) hash.Hash

NewMD5 returns a new HMAC-MD5 hash using the given key.

func NewSHA1

func NewSHA1(key []byte) hash.Hash

NewSHA1 returns a new HMAC-SHA1 hash using the given key.

func NewSHA256

func NewSHA256(key []byte) hash.Hash

NewSHA256 returns a new HMAC-SHA256 hash using the given key.

release.r60.3. Except as noted, this content is licensed under a Creative Commons Attribution 3.0 License.