美天赚sign修改
This commit is contained in:
parent
8ed264d90f
commit
a88648153f
@ -44,11 +44,9 @@ func (s *Sign) GetSign(methodType string, uri string, data map[string]any, signH
|
||||
contentMD5 := s.contentMD5(methodType, data)
|
||||
headers := s.headers(signHeaders)
|
||||
url := s.url(methodType, uri, data)
|
||||
strSign := httpMethod + `\n` + contentMD5 + `\n` + headers + url
|
||||
fmt.Printf("======= strSign:%s \n", strSign)
|
||||
strSign := httpMethod + "\n" + contentMD5 + "\n" + headers + url
|
||||
hm := hmac.New(sha256.New, []byte(s.AppSecret))
|
||||
hm.Write([]byte(strSign))
|
||||
//hash := hex.EncodeToString(hm.Sum(nil))
|
||||
signStr := base64.StdEncoding.EncodeToString(hm.Sum(nil))
|
||||
return signStr
|
||||
}
|
||||
@ -84,7 +82,7 @@ func (s *Sign) headers(signHeaders map[string]string) string {
|
||||
sortData.Sort()
|
||||
|
||||
for _, k := range sortData {
|
||||
str += k + ":" + signHeaders[k] + `\n`
|
||||
str += k + ":" + signHeaders[k] + "\n"
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user