Documentation ¶
Index ¶
- Variables
- func RandomBytes(size int) []byte
- func RandomBytesBuf(buf []byte)
- func RandomBytesBufDeterministic(buf []byte, seed []byte)
- func RandomBytesClose()
- func RandomBytesImplementationName() string
- func RandomBytesRandom() uint32
- func RandomBytesSeedBytes() int
- func RandomBytesSetImplementation(impl *C.struct_randombytes_implementation) int
- func RandomBytesStir()
- func RandomBytesUniform(upperBound uint32) uint32
Constants ¶
This section is empty.
Variables ¶
var RandomBytesSalsa20Implementation *C.struct_randombytes_implementation = &C.randombytes_salsa20_implementation
RandomBytesSalsa20Implementation contains a pointer to C.randombytes_salsa20_implementation This means that it can be used as an argument to RandomBytesSetImplementation
var RandomBytesSysRandomImplementation *C.struct_randombytes_implementation = &C.randombytes_sysrandom_implementation
RandomBytesSysRandomImplementation contains a pointer to C.randombytes_sysrandom_implementation This means that it can be used as an argument to RandomBytesSetImplementation
Functions ¶
func RandomBytes ¶
RandomBytes returns a specified number of random bytes. It is essentially a wrapper around RandomBytesBuf for convenience. Note that this behaviour is different than in NaCl and libsodium, where this function behaves the same as RandomBytesBuf.
func RandomBytesBuf ¶
func RandomBytesBuf(buf []byte)
RandomBytesBuf fills a buffer with random bytes.
func RandomBytesBufDeterministic ¶
RandomBytesBufDeterministic fills a buffer with bytes that are indistinguishable from random bytes without knowing seed.
func RandomBytesClose ¶
func RandomBytesClose()
RandomBytesClose deallocates the resources used by the random number generator.
func RandomBytesImplementationName ¶
func RandomBytesImplementationName() string
RandomBytesImplementationName returns the name of the random number generator that is being used.
func RandomBytesRandom ¶
func RandomBytesRandom() uint32
RandomBytesRandom returns a random 32 bit unsigned integer.
func RandomBytesSeedBytes ¶
func RandomBytesSeedBytes() int
RandomBytesSeedBytes returns the number of bytes required for seeding RandomBytesBufDeterministic.
func RandomBytesSetImplementation ¶
func RandomBytesSetImplementation(impl *C.struct_randombytes_implementation) int
RandomBytesSetImplementation sets the implementation of the random number generator.
func RandomBytesUniform ¶
RandomBytesUniform returns a random number between 0 and an upper bound. The generated bytes have a uniform distribution between 0 and the upper bound.
Types ¶
This section is empty.