chore: cleanup

This commit is contained in:
2026-02-28 16:36:53 +01:00
Unverified
parent 13dde0b4e9
commit 4bffb6214f
5 changed files with 333 additions and 362 deletions

26
utils.go Normal file
View File

@@ -0,0 +1,26 @@
package main
import (
"crypto/sha1"
"fmt"
"strconv"
)
func rgbFromHex(hex string) (int, int, int) {
r, _ := strconv.ParseUint(hex[0:2], 16, 8)
g, _ := strconv.ParseUint(hex[2:4], 16, 8)
b, _ := strconv.ParseUint(hex[4:6], 16, 8)
return int(r), int(g), int(b)
}
func hash(str string) string {
h := sha1.New()
h.Write([]byte(str))
res := h.Sum(nil)
return fmt.Sprintf("%x", res)
}
func hasBit(n uint64, pos int) bool {
val := n & (1 << pos)
return (val > 0)
}