package main import ( "crypto/sha512" "encoding/binary" "fmt" "strconv" ) func Sauce(malid int64, username string) string { return fmt.Sprintf("%x", sha512.Sum512([]byte(registerSecret+strconv.FormatInt(malid, 10)+username))) } func BytesToInt64(bytes []byte) (int64, error) { yes, c := binary.Varint(bytes) if c <= 0 { return yes, fmt.Errorf("int64 decode error: %s", bytes) } return yes, nil } func Int64ToByte(yes int64) []byte { buf := make([]byte, binary.MaxVarintLen64) n := binary.PutVarint(buf, yes) return buf[:n] }