1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-04 12:52:27 +08:00

fix:修复微信回调signType为空的问题 #282 (#283)

Co-authored-by: Avtion <manaitao@heywoods.cn>
This commit is contained in:
EvaCcino
2020-06-23 13:26:15 +08:00
committed by GitHub
parent c14c020a3c
commit 69d0b94fdf

View File

@@ -198,10 +198,10 @@ func decodeNetworkByteOrder(orderBytes []byte) (n uint32) {
// CalculateSign 计算签名 // CalculateSign 计算签名
func CalculateSign(content, signType, key string) (string, error) { func CalculateSign(content, signType, key string) (string, error) {
var h hash.Hash var h hash.Hash
if signType == SignTypeMD5 { if signType == SignTypeHMACSHA256 {
h = md5.New()
} else {
h = hmac.New(sha256.New, []byte(key)) h = hmac.New(sha256.New, []byte(key))
} else {
h = md5.New()
} }
if _, err := h.Write([]byte(content)); err != nil { if _, err := h.Write([]byte(content)); err != nil {