random

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package random provides facilities for generating random or pseudorandom cryptographic objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bits

func Bits(bitlen uint, exact bool, rand cipher.Stream) []byte

Bits chooses a uniform random BigInt with a given maximum BitLen. If 'exact' is true, choose a BigInt with _exactly_ that BitLen, not less

func Bytes

func Bytes(b []byte, rand cipher.Stream)

Bytes fills a slice with random bytes from rand.

func Int

func Int(mod *big.Int, rand cipher.Stream) *big.Int

Int chooses a uniform random big.Int less than a given modulus

func New

func New(readers ...io.Reader) cipher.Stream

New returns a new cipher.Stream that gets random data from the given readers. If no reader was provided, Go's crypto/rand package is used. Otherwise, for each source, 32 bytes are read. They are concatenated and then hashed, and the resulting hash is used as a seed to a PRNG. The resulting cipher.Stream can be used in multiple threads.

Types

This section is empty.

Jump to

Keyboard shortcuts

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