Can someone show me a working example of how to generate a SHA hash of a string that I have, say myPassword := \"beautiful\" , using Go 1 ?
myPassword := \"beautiful\"
The docs pa
Go By Example has a page on sha1 hashing.
package main import ( "fmt" "crypto/sha1" "encoding/hex" ) func main() { s := "sha1 this string" h := sha1.New() h.Write([]byte(s)) sha1_hash := hex.EncodeToString(h.Sum(nil)) fmt.Println(s, sha1_hash) }
You can run this example on play.golang.org