POST watching

This commit is contained in:
daru
2022-04-15 12:13:23 +02:00
parent 25259653e7
commit be195bed30
6 changed files with 257 additions and 143 deletions

26
rechner.go Normal file
View File

@@ -0,0 +1,26 @@
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]
}