12345678910111213141516171819202122 |
- package cryptoutil
- import (
- "crypto/md5"
- "encoding/hex"
- )
- func MD5(str string) string {
- return hex.EncodeToString(MD5Bytes(str))
- }
- func MD5Bytes(str string) []byte {
- m := md5.New()
- _, _ = m.Write([]byte(str))
- return m.Sum(nil)
- }
|