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.
23 lines
394 B
23 lines
394 B
package string
|
|
|
|
import (
|
|
"crypto/hmac"
|
|
"crypto/sha256"
|
|
"encoding/hex"
|
|
"strings"
|
|
)
|
|
|
|
func HmacSha256Hex(key, strToSign string) string {
|
|
hasher := hmac.New(sha256.New, []byte(key))
|
|
hasher.Write([]byte(strToSign))
|
|
return hex.EncodeToString(hasher.Sum(nil))
|
|
}
|
|
|
|
func ToLower(str string) string {
|
|
return strings.ToLower(str)
|
|
}
|
|
|
|
func ToUpper(str string) string {
|
|
return strings.ToUpper(str)
|
|
}
|