random

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FillBytes

func FillBytes(out []byte)

FillBytes fills out with random bytes from the OS CSPRNG, or panics

func UseProvidedOrFillBytes

func UseProvidedOrFillBytes(unitTestNonce, out []byte)

UseProvidedOrFillBytes will fill `out' with unitTestNonce, provided it is not nil and unitTestNonce matches the length of `out' exactly. If unitTestNonce's length is incorrect, this will panic. If unitTestNonce is nil, `out' will be filled with CSPRNG bytes using FillBytes.

This allows us to unit test where encryption would otherwise be non-deterministic. Functions which accept unitTestNonce will not be exported and so do not present a footgun in the user-available API.

Types

This section is empty.

Jump to

Keyboard shortcuts

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