randutil

package
v0.8.6-rc.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ASCII

func ASCII(length int) (string, error)

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 Alphanumeric

func Alphanumeric(length int) (string, error)

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

func Hex(length int) (string, error)

Hex returns a random string of the given length using the hexadecimal characters in lower case (0-9+a-f).

func Salt

func Salt(size int) ([]byte, error)

Salt generates a new random salt of the given size.

func String

func String(length int, chars string) (string, error)

String returns a random string of a given length using the characters in the given string. It splits the string on runes to support UTF-8 characters.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL