parent
4719f21109
commit
7a0ace4cd4
@ -0,0 +1,13 @@
|
||||
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))
|
||||
}
|
Loading…
Reference in new issue