gosdk/wechat/util/signature.go

19 lines
261 B
Go
Raw Normal View History

2024-01-22 22:34:59 +08:00
package util
import (
"crypto/sha1"
"fmt"
"io"
"sort"
)
// Signature sha1签名
func Signature(params ...string) string {
sort.Strings(params)
h := sha1.New()
for _, s := range params {
io.WriteString(h, s)
}
return fmt.Sprintf("%x", h.Sum(nil))
}