Documentation ¶
Overview ¶
Package randutil provides methods to generate random strings and salts.
Index ¶
- func ASCII(length int) (string, error)
- func Alphabet(length int) (string, error)
- func Alphanumeric(length int) (string, error)
- func Bytes(size int) ([]byte, error)
- func Hex(length int) (string, error)
- func Salt(size int) ([]byte, error)
- func String(length int, chars string) (string, error)
- func UUIDv4() (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ASCII ¶
ASCII returns a securely generated random ASCII string. It reads random numbers from crypto/rand and searches for printable characters. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller must not continue.
func Alphabet ¶ added in v0.8.1
Alphabet returns a random string of the given length using the 52 alphabetic characters in the POSIX/C locale (a-z+A-Z).
func Alphanumeric ¶
Alphanumeric returns a random string of the given length using the 62 alphanumeric characters in the POSIX/C locale (a-z+A-Z+0-9).
func Hex ¶
Hex returns a random string of the given length using the hexadecimal characters in lower case (0-9+a-f).
Types ¶
This section is empty.