21 lines
355 B
Go
21 lines
355 B
Go
package common
|
|
|
|
import (
|
|
"crypto/md5"
|
|
"encoding/hex"
|
|
"fmt"
|
|
"io"
|
|
)
|
|
|
|
func GetRawPassword(pwd string, ts ...int64) string {
|
|
var raw string
|
|
if len(ts) > 0 {
|
|
raw = fmt.Sprintf("%v%v%v", pwd, GetAppId(), ts[0])
|
|
} else {
|
|
raw = fmt.Sprintf("%v%v", pwd, GetAppId())
|
|
}
|
|
ht := md5.New()
|
|
io.WriteString(ht, raw)
|
|
return hex.EncodeToString(ht.Sum(nil))
|
|
}
|