package cryptotest
Import Path
testing/cryptotest (on go.dev)
Dependency Relation
imports 7 packages, and imported by 0 packages
Involved Source Files
Package cryptotest provides deterministic random source testing.
Package-Level Functions (only one)
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").
![]() |
The pages are generated with Golds v0.8.3-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |