GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Why Go
  • Case Studies
  • Use Cases
  • Security
  • Learn
  • Effective Go
  • Go User Manual
  • Standard library
  • Release Notes
  • API
  • Packages
  • Recorded Talks
  • Meetups
  • Conferences

This view

  • Original page
  • New address

GeezerVison is showing pkg.go.dev — entropy package - crypto/internal/entropy/v1.0.0 - Go Packages

Details

  • checked Valid go.mod file

    The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.

  • checked Redistributable license

    Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.

  • checked Tagged version

    Modules with tagged versions give importers more predictable builds.

  • checked Stable version

    When a project reaches major version v1 it is considered stable.

  • Learn more about best practices

Repository

cs.opensource.google/go/go

Links

  • Report a Vulnerability

Documentation ¶

Overview ¶

Package entropy implements a CPU jitter-based SP 800-90B entropy source.

Index ¶

  • func AdaptiveProportionTest(samples []uint8) error
  • func RepetitionCountTest(samples []uint8) error
  • func SHA384(p *[1024]byte) [48]byte
  • func Samples(samples []uint8, memory *ScratchBuffer) error
  • func Seed(memory *ScratchBuffer) ([48]byte, error)
  • func TestingOnlySHA384(p []byte) [48]byte
  • func Version() string
  • type ScratchBuffer

Constants ¶

This section is empty.

Variables ¶

This section is empty.

Functions ¶

func AdaptiveProportionTest ¶

func AdaptiveProportionTest(samples []uint8) error

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

func RepetitionCountTest ¶

func RepetitionCountTest(samples []uint8) error

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

func SHA384 ¶

func SHA384(p *[1024]byte) [48]byte

func Samples ¶

func Samples(samples []uint8, memory *ScratchBuffer) error

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.

func Seed ¶

func Seed(memory *ScratchBuffer) ([48]byte, error)

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 ¶

func TestingOnlySHA384(p []byte) [48]byte

func Version ¶

func Version() string

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.

Types ¶

type ScratchBuffer ¶

type ScratchBuffer [1 << 25]byte

ScratchBuffer is a large buffer that will be written to using atomics, to generate noise from memory access timings. Its contents do not matter.

Source Files ¶

View all Source files
  • entropy.go
  • sha384.go
Click to show internal directories.
Click to hide internal directories.
You are visitor 01402605 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.