You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
348 B
18 lines
348 B
|
2 weeks ago
|
package pg4
|
||
|
|
|
||
|
|
import (
|
||
|
|
"crypto/md5"
|
||
|
|
"encoding/hex"
|
||
|
|
"strconv"
|
||
|
|
"strings"
|
||
|
|
|
||
|
|
"github.com/liangdas/mqant/log"
|
||
|
|
)
|
||
|
|
|
||
|
|
func GenerateSign(body string, timestamp int64, key string) string {
|
||
|
|
data := body + strconv.FormatInt(timestamp, 10) + key
|
||
|
|
log.Info("data:%v", data)
|
||
|
|
hash := md5.Sum([]byte(data))
|
||
|
|
return strings.ToUpper(hex.EncodeToString(hash[:]))
|
||
|
|
}
|