random

package
v0.0.0-...-0b3308b Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2017 License: MPL-2.0 Imports: 4 Imported by: 7

Documentation

Overview

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

XXX this package might go away and get subsumed by the currently equivalent abstract.Stream type.

Index

Constants

This section is empty.

Variables

View Source
var Stream cipher.Stream = new(randstream)

Standard virtual "stream cipher" that just generates fresh cryptographically strong random bits.

Functions

func Bits

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

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

func Bool

func Bool(rand cipher.Stream) bool

Choose a uniform random boolean

func Byte

func Byte(rand cipher.Stream) byte

Choose a uniform random byte

func Bytes

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

Choose a random n-byte slice

func Int

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

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

func NonZeroBytes

func NonZeroBytes(n int, rand cipher.Stream) []byte

NonZeroBytes calls Bytes as long as it gets a slice full of '0's. This is needed when using suite.Cipher(abstract.NoKey) because the first 6 iterations returns 0000...000 as bytes for edwards & ed25519 cipher. XXX Issue reported in https://github.com/dedis/crypto/issues/70

func Uint16

func Uint16(rand cipher.Stream) uint16

Choose a uniform random uint16

func Uint32

func Uint32(rand cipher.Stream) uint32

Choose a uniform random uint32

func Uint64

func Uint64(rand cipher.Stream) uint64

Choose a uniform random uint64

func Uint8

func Uint8(rand cipher.Stream) uint8

Choose a uniform 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