feat(web): improve token generation
This commit is contained in:
parent
f8d988883f
commit
bf1a652b91
@ -27,8 +27,8 @@ var TOKEN = ""
|
|||||||
func TokenGenerate(seed []byte) {
|
func TokenGenerate(seed []byte) {
|
||||||
SID = time.Now().Unix()
|
SID = time.Now().Unix()
|
||||||
value := SID
|
value := SID
|
||||||
for _, char := range seed {
|
for i, char := range seed {
|
||||||
value += int64(char)
|
value += int64(char) << (i * 8)
|
||||||
}
|
}
|
||||||
TOKEN = fmt.Sprintf("%x", sha256.Sum256([]byte(strconv.FormatInt(value, 16))))
|
TOKEN = fmt.Sprintf("%x", sha256.Sum256([]byte(strconv.FormatInt(value, 16))))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user