Lines Matching defs:hmac
6 Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as
8 An HMAC is a cryptographic hash that uses a key to sign a message.
14 // CheckMAC reports whether messageMAC is a valid HMAC tag for message.
16 mac := hmac.New(sha256.New, key)
19 return hmac.Equal(messageMAC, expectedMAC)
22 package hmac
35 // hmac = H([key ^ opad] H([key ^ ipad] text))
37 type hmac struct {
44 func (h *hmac) Sum(in []byte) []byte {
53 func (h *hmac) Write(p []byte) (n int, err error) {
57 func (h *hmac) Size() int { return h.size }
59 func (h *hmac) BlockSize() int { return h.blocksize }
61 func (h *hmac) Reset() {
66 // New returns a new HMAC hash using the given hash.Hash type and key.
68 hm := new(hmac)