标签:
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 }
标签:
原文地址:http://www.cnblogs.com/allenhaozi/p/5773788.html