package random
import "go.dedis.ch/kyber/v3/util/random"
Package random provides facilities for generating random or pseudorandom cryptographic objects.
Index ¶
- func Bits(bitlen uint, exact bool, rand cipher.Stream) []byte
- func Bytes(b []byte, rand cipher.Stream)
- func Int(mod *big.Int, rand cipher.Stream) *big.Int
- func New(readers ...io.Reader) cipher.Stream
Functions ¶
func Bits ¶
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 ¶
Bytes fills a slice with random bytes from rand.
func Int ¶
Int chooses a uniform random big.Int less than a given modulus
func New ¶
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.
Source Files ¶
rand.go
- Version
- v3.1.0 (latest)
- Published
- Nov 30, 2022
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 1 month ago –
Tools for package owners.