jacdac.rng

Submodules

Package Contents

Classes

RngClient

Generates random numbers using entropy sourced from physical processes.

class jacdac.rng.RngClient(bus: jacdac.bus.Bus, role: str)

Bases: jacdac.bus.Client

Generates random numbers using entropy sourced from physical processes.
  • This typically uses a cryptographical pseudo-random number generator (for example [Fortuna](<https://en.wikipedia.org/wiki/Fortuna_(PRNG)>)),

  • which is periodically re-seeded with entropy coming from some hardware source.

Implements a client for the Random Number Generator service.

property random: bytes | None

A register that returns a 64 bytes random buffer on every request. This never blocks for a long time. If you need additional random bytes, keep querying the register.,

property variant: jacdac.rng.constants.RngVariant | None

(Optional) The type of algorithm/technique used to generate the number. Quantum refers to dedicated hardware device generating random noise due to quantum effects. ADCNoise is the noise from quick readings of analog-digital converter, which reads temperature of the MCU or some floating pin. WebCrypto refers is used in simulators, where the source of randomness comes from an advanced operating system.,