fix: Refactor crypto

This commit is contained in:
Prad N
2025-03-11 13:57:03 -04:00
parent 090ee30ba3
commit 00b23353c9
285 changed files with 0 additions and 68698 deletions
-22
View File
@@ -1,22 +0,0 @@
package random
import (
"crypto/rand"
"encoding/binary"
)
// GetRandomBytes randomly generates n bytes.
func GetRandomBytes(n uint32) []byte {
buf := make([]byte, n)
_, err := rand.Read(buf)
if err != nil {
panic(err) // out of randomness, should never happen
}
return buf
}
// GetRandomUint32 randomly generates an unsigned 32-bit integer.
func GetRandomUint32() uint32 {
b := GetRandomBytes(4)
return binary.BigEndian.Uint32(b)
}