2020-05-24 13:28:32 +08:00

23 lines
596 B
Go

// Copyright 2017-2020 The ShadowEditor Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
//
// For more information, please visit: https://github.com/tengge1/ShadowEditor
// You can also visit: https://gitee.com/tengge1/ShadowEditor
package helper
import (
"crypto/md5"
"encoding/hex"
)
// MD5 convert a string to md5 encrypt string.
//
// TODO: Using md5 to encrypt passwords is not very secure.
func MD5(str string) string {
h := md5.New()
h.Write([]byte(str))
return hex.EncodeToString(h.Sum(nil))
}