From 69d0b94fdfca7ed58efca2639af5fee746ab1b7d Mon Sep 17 00:00:00 2001 From: EvaCcino <34846850+avtion@users.noreply.github.com> Date: Tue, 23 Jun 2020 13:26:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=9B=9E=E8=B0=83signType=E4=B8=BA=E7=A9=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20#282=20(#283)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Avtion --- util/crypto.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/crypto.go b/util/crypto.go index 2374fb6..623ebd6 100644 --- a/util/crypto.go +++ b/util/crypto.go @@ -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 {