package entropy
Import Path
crypto/internal/entropy/v1.0.0 (on go.dev)
Dependency Relation
imports 5 packages, and imported by one package
Involved Source Files
Package entropy implements a CPU jitter-based SP 800-90B entropy source.
sha384.go
Package-Level Type Names (only one)
Package-Level Functions (total 7)
AdaptiveProportionTest implements the adaptive proportion test from SP 800-90B
Section 4.4.2. It returns an error if any symbol appears C = 410 or more
times in the last W = 512 samples.
This C value is calculated from a target failure probability α = 2⁻²⁰, a
window size W = 512, and a claimed min-entropy per symbol h = 0.5 bits, using
the formula in SP 800-90B Section 4.4.2, equivalent to the Microsoft Excel
formula 1+CRITBINOM(W, power(2,(−H)),1−α).
sage: from scipy.stats import binom
sage: α = 2^-20
sage: H = 0.5
sage: W = 512
sage: C = 1 + binom.ppf(1 - α, W, 2**(-H))
sage: ceil(C)
410
RepetitionCountTest implements the repetition count test from SP 800-90B
Section 4.4.1. It returns an error if any symbol is repeated C = 41 or more
times in a row.
This C value is calculated from a target failure probability α = 2⁻²⁰ and a
claimed min-entropy per symbol h = 0.5 bits, using the formula in SP 800-90B
Section 4.4.1.
sage: α = 2^-20
sage: H = 0.5
sage: 1 + ceil(-log(α, 2) / H)
41
Samples starts a new entropy source, collects the requested number of
samples, conducts startup health tests, and returns the samples or an error
if the health tests fail.
The health tests have a non-negligible chance of failing.
Seed returns a 384-bit seed with full entropy.
memory is passed in to allow changing the allocation strategy without
modifying the frozen and certified entropy source in this package.
Seed returns an error if the entropy source startup health tests fail, which
has a non-negligible chance of happening.
func TestingOnlySHA384(p []byte) [48]byte
Version returns the version of the entropy source.
This is independent of the FIPS 140-3 module version, in order to reuse the
ESV certificate across module versions.
![]() |
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. |