src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

hmac.go (252B)


      1 package v4
      2 
      3 import (
      4 	"crypto/hmac"
      5 	"crypto/sha256"
      6 )
      7 
      8 // HMACSHA256 computes a HMAC-SHA256 of data given the provided key.
      9 func HMACSHA256(key []byte, data []byte) []byte {
     10 	hash := hmac.New(sha256.New, key)
     11 	hash.Write(data)
     12 	return hash.Sum(nil)
     13 }