gouid package - github.com/twharmon/gouid - Go Packages

Package guoid provides cryptographically secure unique identifiers of type string and type []byte.

On Linux, FreeBSD, Dragonfly and Solaris, getrandom(2) is used if available, /dev/urandom otherwise. On OpenBSD and macOS, getentropy(2) is used. On other Unix-like systems, /dev/urandom is used. On Windows systems, the RtlGenRandom API is used. On Wasm, the Web Crypto API is used.

This section is empty.

View Source

var (
	
	
	Secure32Char = []byte("abcdefghijklmnopqrstuvwxyz012345")
	Secure64Char = []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-")
)

Charsets for string gouids.

String returns a string with the given size made up of characters from the given charset. Ids are made with cryptographically secure random bytes. The length of charset must not exceed 256.

GOUID is a byte slice.

func Bytes(size int) GOUID

Bytes returns cryptographically secure random bytes.

MarshalJSON hex encodes the gouid.

String implements the Stringer interface.

UnmarshalJSON decodes a hex encoded string into a gouid.