feat: add HmacSha1

This commit is contained in:
tiglog 2023-08-12 21:29:17 +08:00
parent 28ae60757b
commit fdd5b07992

View File

@ -8,6 +8,7 @@
package gsha1
import (
"crypto/hmac"
"crypto/sha1"
"encoding/hex"
"io"
@ -45,3 +46,10 @@ func MustEncryptFile(path string) string {
}
return result
}
// hmac sha1
func HmacSha1(in, key []byte) []byte {
h := hmac.New(sha1.New, key)
h.Write(in)
return h.Sum(nil)
}