Go to file
kayos@tcp.direct 37d32621e8 Make godoc happy 2022-01-01 23:44:05 -08:00
LICENSE Make godoc happy 2022-01-01 23:44:05 -08:00
README.md Add: random string, docs 2022-01-01 14:01:21 -08:00
entropy_test.go Make godoc happy 2022-01-01 23:44:05 -08:00
go.mod init 2022-01-01 13:39:27 -08:00
go.sum init 2022-01-01 13:39:27 -08:00
range.go init 2022-01-01 13:39:27 -08:00
util.go Add: random string, docs 2022-01-01 14:01:21 -08:00

common

-- import "git.tcp.direct/kayos/common"

stuff I use a lot.

func Abs

func Abs(n int) int

Abs will give you the positive version of a negative integer, quickly.

func BytesToBlake2b

func BytesToBlake2b(b []byte) []byte

BytesToBlake2b ignores all errors and gives you a blakae2b 64 hash value as a byte slice. (or panics somehow)

func CompareChecksums

func CompareChecksums(a []byte, b []byte) bool

CompareChecksums will take in two byte slices, hash them with blake2b, and tell you if the resulting checksums match.

func Fprint

func Fprint(w io.Writer, s string)

Fprint is fmt.Fprint with error handling.

func RNG

func RNG(n int) int

RNG is a Random Number Generator

func RandSleepMS

func RandSleepMS(n int)

RandSleepMS sleeps for a random period of time with a maximum of n milliseconds.

func RandStr

func RandStr(size int) string

RandStr generates a random alphanumeric string with a max length of size.

func RangeIterate

func RangeIterate(ips interface{}) chan *ipa.IP