github.com/qxnw/lib4go@v0.0.0-20180426074627-c80c7e84b925/security/sha1/sha1.go (about) 1 package sha1 2 3 import ( 4 "crypto/sha1" 5 "fmt" 6 ) 7 8 // Encrypt SHA1加密 9 func Encrypt(content string) string { 10 h := sha1.New() 11 h.Write([]byte(content)) 12 bs := h.Sum(nil) 13 h.Reset() 14 r := fmt.Sprintf("%x", bs) 15 return r 16 }