mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-04 12:52:27 +08:00
Co-authored-by: Avtion <manaitao@heywoods.cn>
This commit is contained in:
@@ -198,10 +198,10 @@ func decodeNetworkByteOrder(orderBytes []byte) (n uint32) {
|
||||
// CalculateSign 计算签名
|
||||
func CalculateSign(content, signType, key string) (string, error) {
|
||||
var h hash.Hash
|
||||
if signType == SignTypeMD5 {
|
||||
h = md5.New()
|
||||
} else {
|
||||
if signType == SignTypeHMACSHA256 {
|
||||
h = hmac.New(sha256.New, []byte(key))
|
||||
} else {
|
||||
h = md5.New()
|
||||
}
|
||||
|
||||
if _, err := h.Write([]byte(content)); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user