19 lines
268 B
Go
19 lines
268 B
Go
|
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))
|
||
|
}
|