crand

package module
v0.0.0-...-f30c14f Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2017 License: MIT Imports: 3 Imported by: 6

README

Crand

A library that proxies crypto/rand with diverse simple functions.

Values returned exclude the maximum.

Godoc

Example

Generate a secure, random token

fmt.Printf("Token: %v", crand.String(20))

Disclaimer

I have no formal education in cryptography. The randomness is derived from crypto/rand and I've implemented safeguards against modulus bias.

Documentation

Index

Constants

View Source
const (
	CharSetDefault = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
	CharSetAlpha   = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
	CharSetUpper   = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	CharSetLower   = "abcdefghijklmnopqrstuvwxyz"
)

Charsets

Variables

This section is empty.

Functions

func String

func String(size int) string

String returns a random string using CharSetDefault

func StringCharset

func StringCharset(charSet string, size int) string

StringCharset generates a random string using the provided charset and size

func Uint

func Uint(max uint) uint

Uint returns a random uint

func Uint16

func Uint16(max uint16) uint16

Uint16 returns a random uint16

func Uint32

func Uint32(max uint32) uint32

Uint32 returns a random uint32

func Uint64

func Uint64(max uint64) uint64

Uint64 returns a random uint64

func Uint8

func Uint8(max uint8) uint8

Uint8 returns a random uint8

Types

This section is empty.

Jump to

Keyboard shortcuts

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