Esempio n. 1
0
func main() {
	fmt.Println(crypto.Sha1([]byte("123456")))
	fmt.Println(domain.PartnerSha1Pwd("zs", "zs#12345"))

	fmt.Println(domain.NewApiId(105))
	fmt.Println(domain.MemberSha1Pwd("123456"))
	fmt.Println(1 << 2)
	fmt.Println(util.IsMobileAgent("Mozilla/5.0 (Linux; U; Android 2.3.7; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"))

	tagRegexp := regexp.MustCompile("\\s*([^:\\|]+):([^:\\|]+)\\s*\\|*")
	matches := tagRegexp.FindAllStringSubmatch("G1:10|G2:12|G3:14", -1)
	for i := 0; i < len(matches); i++ {
		fmt.Println(i, "---", matches[i][1], matches[i][2])
	}

	fmt.Println("/main/change_device?device=3&return_url=/main/t/123" +
		url.QueryEscape("?return_url=/app"))
}
Esempio n. 2
0
//加密合作商密码
func PartnerSha1Pwd(usr, pwd string) string {
	return crypto.Sha1([]byte(ShaPwd(pwd, usr+":")))
}
Esempio n. 3
0
// 密码SHA1加密
func ShaPwd(pwd, offset string) string {
	return crypto.Sha1([]byte(strings.Join([]string{offset, pwd, "@h3f.net"}, "")))
}
Esempio n. 4
0
// 加密会员密码,因为可能会使用手机号码登陆,
// 所以密码不能依据用户名作为生成凭据
func MemberSha1Pwd(pwd string) string {
	return crypto.Sha1([]byte(ShaPwd(pwd, "")))
}