You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-library/string/string.go

14 lines
251 B

package string
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
)
func HmacSha256Hex(key, strToSign string) string {
hasher := hmac.New(sha256.New, []byte(key))
hasher.Write([]byte(strToSign))
return hex.EncodeToString(hasher.Sum(nil))
}