16 lines
242 B
Go
16 lines
242 B
Go
package encoder
|
|
|
|
import (
|
|
"crypto/md5"
|
|
"fmt"
|
|
)
|
|
|
|
func Md5Encode(str string) string {
|
|
hash := md5.New()
|
|
_, _ = hash.Write([]byte(str))
|
|
|
|
// Get the resulting encoded byte slice
|
|
md5Hash := hash.Sum(nil)
|
|
return fmt.Sprintf("%x", md5Hash)
|
|
}
|