cryptotest

package standard library
go1.27.4 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: BSD-3-Clause Imports: 7 Imported by: 5 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cryptotest provides deterministic random source testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetGlobalRandom

func SetGlobalRandom(t *testing.T, seed uint64)

SetGlobalRandom sets a global, deterministic cryptographic randomness source for the duration of test t. It affects crypto/rand, and all implicit sources of cryptographic randomness in the crypto/... packages.

SetGlobalRandom may be called multiple times in the same test to reset the random stream or change the seed.

Because SetGlobalRandom affects the whole process, it cannot be used in parallel tests or tests with parallel ancestors.

Note that the way cryptographic algorithms use randomness is generally not specified and may change over time. Thus, if a test expects a specific output from a cryptographic function, it may fail in the future even if it uses SetGlobalRandom.

SetGlobalRandom is not supported when building against the Go Cryptographic Module v1.0.0 (i.e. when crypto/fips140.Version returns "v1.0.0").

Types

This section is empty.

Jump to

Keyboard shortcuts

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