Narven
1/3/2017 - 4:20 AM

Golang - How to hash a string using MD5.

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))
}