kyber: go.dedis.ch/kyber/util/random Index | Files

package random

import "go.dedis.ch/kyber/util/random"

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

Index

Package Files

rand.go

func Bits Uses

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 Uses

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

Bytes fills a slice with random bytes from rand.

func Int Uses

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

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

func New Uses

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.

Package random imports 7 packages (graph) and is imported by 2 packages. Updated 2019-10-19. Refresh now. Tools for package owners.