golang中crypto/sha1包
2018-12-09 本文已影响1人
ljh123
sha1是安全哈希算法。
const BlockSize = 64
功能说明:
SHA1的数据块的字节长度位为64字节。
const Size = 20
功能说明:
SHA1的校验和的字节长度为20字节。
package main
import (
"fmt"
"crypto/sha1"
)
func main() {
h := sha1.New()
h.Write([]byte("hello,sha1"))
l := fmt.Sprintf("%x", h.Sum(nil))
fmt.Println(l)
}