golang hmac sha256加密

func hmacSha256(data string, secret string) string {
    h := hmac.New(sha256.New, []byte(secret))
    h.Write([]byte(data))
    return hex.EncodeToString(h.Sum(nil))
}

 

posted @ 2019-08-07 17:03  _DongGe  阅读(10115)  评论(0编辑  收藏  举报