frostfs-s3-gw/api/auth/signer/v4asdk2/internal/v4/hmac.go

14 lines
252 B
Go
Raw Normal View History

package v4
import (
"crypto/hmac"
"crypto/sha256"
)
// HMACSHA256 computes a HMAC-SHA256 of data given the provided key.
func HMACSHA256(key []byte, data []byte) []byte {
hash := hmac.New(sha256.New, key)
hash.Write(data)
return hash.Sum(nil)
}