golang中的hmac验证应该怎样写

shiki · · 7828 次点击
package main import ( "crypto/hmac" "crypto/sha1" "fmt" "io" ) func main() { //sha1 h := sha1.New() io.WriteString(h, "aaaaaa") fmt.Printf("%x\n", h.Sum(nil)) //hmac ,use sha1 key := []byte("123456") mac := hmac.New(sha1.New, key) mac.Write([]byte("aaaaaa")) fmt.Printf("%x\n", mac.Sum(nil)) }
#1
更多评论
不能编辑回复吗,那到我blog看吧 http://www.wulinlw.org/sort/35 以前写btc接口的时候弄的
#2
polaris
社区,需要你我一同完善!
编辑问题我会尽快加上。
#3