crypto/sha1 package
package main
import (
    "crypto/sha1"
    "fmt"
)
func main() {
    text := "Hello"
    hasher := sha1.New()
    hasher.Write([]byte(text))
    rawDigest := hasher.Sum(nil)
    digest := fmt.Sprintf("%x", rawDigest)
    fmt.Println(digest)
}
Leave a Comment
Cancel reply