generator

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LowerCaseChars    = "abcdefghijklmnopqrstuvwxyz"
	UpperCaseChars    = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	NumberChars       = "0123456789"
	SpecialChars      = " !\"£$%^&*()-_=+]}[{#~'@;:/?.>,<\\|`¬"
	AlphabetChars     = LowerCaseChars + UpperCaseChars
	AlphaNumericChars = AlphabetChars + NumberChars
	AllChars          = AlphaNumericChars + SpecialChars
)

Variables

View Source
var ErrorBadCharSet = errors.New("availableCharBytes length must be greater" +
	" than 0 and less than or equal to 256")

Functions

func RandomBytes

func RandomBytes(length int) ([]byte, error)

RandomBytes returns the requested number of bytes using crypto/rand

Types

type Random

type Random struct {
	// contains filtered or unexported fields
}

func NewRandom

func NewRandom(charSet string) (*Random, error)

func (Random) SecureRandomBytes

func (g Random) SecureRandomBytes(length int) ([]byte, error)

SecureRandomBytes returns a byte array of the requested length, made from the byte characters provided in NewRandom(). It uses crypto/rand for security.

Jump to

Keyboard shortcuts

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