matrix-bot/krkrkr/krkrkr.go
shinya 64b6e71b0e
Some checks failed
Deploy Matrix Bot / deploy (push) Waiting to run
Docker Build / build (push) Failing after 20m2s
new init without secrets
2026-03-04 22:00:42 +01:00

32 lines
500 B
Go

package krkrkr
import "time"
func Today() int {
return hashRounds(100, int(time.Now().Unix()/86400))
}
func hashRounds(rounds int, start int) int {
for i := 0; i < rounds; i++ {
start = hash(start)
}
return start
}
func hash(x int) int {
for i := 0; i < 5; i++ {
o := x
o ^= 0xDADADADA
o *= 0xBAADFACC
o ^= 0xFEEDFACE
o += 0xC0FFEE
o = (o << 13) | (o >> (32 - 13))
o *= o
o ^= (o >> 17)
o *= 0x5DEECE66D
o ^= 0xB16B00B5
x = o % 0x7FFFFFFF
}
return x & 0x7FFFFFFF
}