24 lines
587 B
Go
24 lines
587 B
Go
/**
|
|
#*****************************************************************************
|
|
# @file md5.go
|
|
# @author MakerYang(https://www.makeryang.com)
|
|
# @statement 免费课程配套开源项目,任何形式收费均为盗版
|
|
#*****************************************************************************
|
|
*/
|
|
|
|
package Utils
|
|
|
|
import (
|
|
"crypto/md5"
|
|
"encoding/hex"
|
|
)
|
|
|
|
func MD5Hash(text string) string {
|
|
hash := md5.Sum([]byte(text))
|
|
return hex.EncodeToString(hash[:])
|
|
}
|
|
|
|
func VerifyPassword(storedPassword, inputPassword string) bool {
|
|
return MD5Hash(inputPassword) == storedPassword
|
|
}
|