MCPcopy
hub / github.com/silenceper/wechat / ParamSign

Function ParamSign

util/crypto.go:215–230  ·  view source on GitHub ↗

ParamSign 计算所传参数的签名

(p map[string]string, key string)

Source from the content-addressed store, hash-verified

213
214// ParamSign 计算所传参数的签名
215func ParamSign(p map[string]string, key string) (string, error) {
216 bizKey := "&key=" + key
217 str := OrderParam(p, bizKey)
218
219 var signType string
220 switch p["sign_type"] {
221 case SignTypeMD5, SignTypeHMACSHA256:
222 signType = p["sign_type"]
223 case ``:
224 signType = SignTypeMD5
225 default:
226 return ``, errors.New(`invalid sign_type`)
227 }
228
229 return CalculateSign(str, signType, key)
230}
231
232// ECB provides confidentiality by assigning a fixed ciphertext block to each plaintext block.
233// See NIST SP 800-38A, pp 08-09

Callers 7

RefundMethod · 0.92
SendRedpacketMethod · 0.92
WalletTransferMethod · 0.92
QueryOrderMethod · 0.92
CloseOrderMethod · 0.92
BridgeAppConfigMethod · 0.92
PrePayOrderMethod · 0.92

Calls 2

OrderParamFunction · 0.85
CalculateSignFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…