You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
524 B

package comFunc
import (
"crypto/md5"
"encoding/hex"
)
// 简单判断邀请码或者注册码
func JudgeInvitOrIntro(code string) string {
if len(code) == 6 {
return "Invit"
} else if len(code) == 8 {
return "Intro"
} else {
return "Platform"
}
}
// 返回md5的序列值, 16 或者32位
func SerializeMd5(data string, size int) string {
m := md5.New()
m.Write([]byte(data + "UpgradeCode"))
cipherStr := m.Sum(nil)
res := hex.EncodeToString(cipherStr)
if size == 16 {
res = res[8:24]
}
return res
}