feat: add HmacSha1
This commit is contained in:
parent
28ae60757b
commit
fdd5b07992
@ -8,6 +8,7 @@
|
|||||||
package gsha1
|
package gsha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/hmac"
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"io"
|
"io"
|
||||||
@ -45,3 +46,10 @@ func MustEncryptFile(path string) string {
|
|||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// hmac sha1
|
||||||
|
func HmacSha1(in, key []byte) []byte {
|
||||||
|
h := hmac.New(sha1.New, key)
|
||||||
|
h.Write(in)
|
||||||
|
return h.Sum(nil)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user