Documentation ¶
Overview ¶
Package sampling implements secure sampling of bytes and integers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandComplex128 ¶
func RandComplex128(min, max float64) complex128
RandComplex128 returns a random complex with the real and imaginary part between min and max.
func RandFloat64 ¶
RandFloat64 returns a random float between min and max.
func RandUint64 ¶
func RandUint64() uint64
RandUint64 return a random value between 0 and 0xFFFFFFFFFFFFFFFF.
Types ¶
type KeyedPRNG ¶
type KeyedPRNG struct {
// contains filtered or unexported fields
}
KeyedPRNG is a structure storing the parameters used to securely and deterministically generate shared sequences of random bytes among different parties using the hash function blake2b. Backward sequence security (given the digest i, compute the digest i-1) is ensured by default, however forward sequence security (given the digest i, compute the digest i+1) is only ensured if the KeyedPRNG is keyed.
func NewKeyedPRNG ¶
NewKeyedPRNG creates a new instance of KeyedPRNG. Accepts an optional key, else set key=nil which is treated as key=[]byte{} WARNING: A PRNG INITIALISED WITH key=nil IS INSECURE!
func NewPRNG ¶
NewPRNG creates KeyedPRNG keyed from rand.Read for instances were no key should be provided by the user
func (*KeyedPRNG) Key ¶
Key returns a copy of the key used to seed the PRNG. This value can be used with `NewKeyedPRNG` to instantiate a new PRNG that will produce the same stream of bytes.