Skip to content

Instantly share code, notes, and snippets.

@alexsunxl
Forked from sergiotapia/md5-example.go
Created May 15, 2017 03:21
Show Gist options
  • Save alexsunxl/c8357005561caa32adfdfb1b23a3b4ec to your computer and use it in GitHub Desktop.
Save alexsunxl/c8357005561caa32adfdfb1b23a3b4ec to your computer and use it in GitHub Desktop.
Golang - How to hash a string using MD5.
import (
"crypto/md5"
"encoding/hex"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment