rand

package
v0.0.0-...-8a109c3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 3 Imported by: 2

Documentation

Overview

Package rand provides support for various RNG-related functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomBytes

func RandomBytes(bytesToRead int) []byte

RandomBytes generates bytesToRead random bytes. This implementation uses either the default RNG algorithm ("system"), or whichever algorithm has been selected by RandomBytesSwitchAlgorithm.

func RandomBytesCustomAlgorithm

func RandomBytesCustomAlgorithm(fun func([]byte, int)) error

RandomBytesCustomAlgorithm switches RandomBytes to use the given function. This allows additional custom RNGs besides the provided ones. The provided RNG function must have the same signature as RandomBytesInPlace, i.e. func([]byte, int).

func RandomBytesInPlace

func RandomBytesInPlace(randomArray []byte, bytesToRead int)

RandomBytesInPlace generates bytesToRead random bytes. This implementation uses either the default RNG algorithm ("system"), or whichever algorithm has been selected by RandomBytesSwitchAlgorithm. If bytesToRead exceeds the size of randomArray, only len(randomArray) bytes are read.

func RandomBytesSwitchAlgorithm

func RandomBytesSwitchAlgorithm(algName string) error

RandomBytesSwitchAlgorithm switches the core OQS_randombytes to use the specified algorithm. Possible values are "system" and "OpenSSL". See <oqs/rand.h> liboqs header for more details.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL