package models import ( "crypto/hmac" "crypto/sha1" "encoding/base64" "net/url" ) func Sha1(query string, pri_key string) string { key := []byte(pri_key) mac := hmac.New(sha1.New, key) mac.Write([]byte(query)) query = base64.StdEncoding.EncodeToString(mac.Sum(nil)) query = url.QueryEscape(query) return query }
时间: 2024-10-18 07:53:59