Repository navigation
Releases
Releases · NCodeGroup/Randomness
v0.5.2
Added
ISecureRandom, registered byAddRandomness(): an NIST SP 800-90A HMAC_DRBG with HMAC-SHA-512 per processor,
buffered, seeded and reseeded from the operating system's CSPRNG, and reseeded with every beacon pulse mixed in, after
ReseedIntervaland afterReseedAfterBytes.SystemRandomSource.Instance: the operating system's CSPRNG as anISecureRandom.RandomnessHost, for console tools and libraries without dependency injection:RandomnessHost.CreateBuilder()
takes the options, configuration section and beaconsAddRandomness()takes,BuildAsync()validates the options
and starts the background beacon collection, andDisposeAsync()stops it and zeroes the generator's state
(#4,
ADR-1011).IRandomSourceextension members: unbiasedNextInteger<T>for every integer type frombytetoUInt128, with
or without bounds,NextDouble,NextSingle,NextBoolean,NextGuid(version 4),GetBytes,Shuffle,
GetItem,GetItems,GetStringandAsRandom.IRandomnessBeaconandBeaconPulse, the port a beacon adapter implements, registered withAddBeacon<TBeacon>().- A background beacon collector with
Continuous,InitializeOnlyandOfflinemodes, per-fetch timeouts,
exponential back-off with jitter, an optionalRequireInitialPulsestart check, and a pulse age limit per beacon,
MaxPulseAgeByBeacon(ADR-1008). IBeaconStatus, the health checkAddRandomnessBeacons(), and the metricsncode.randomness.beacon.pulsesand
ncode.randomness.generator.reseeds.- Reproducible draws:
IVerifiableRandomFactoryandVerifiableRandom, algorithmncode-randomness-draw/1, specified
indocs/draws.mdwith a reference implementation. NCode.Randomness.Curby: the CURBy beacon,AddCurbyBeacon(), over the CURBy-RNG Twine chain, and the CURBy-Q
beacon,AddCurbyQuantumBeacon(), namedcurby-q, over the rounds of the CURBy-Q (DIRNG) chain, with settings in
RandomnessBeacons:Curby
(#1,
ADR-1007).- Offline verifiers that check a published draw without the network:
CurbyPulseVerifierand
CurbyQuantumRoundVerifierinNCode.Randomness.Curby,NistPulseVerifierinNCode.Randomness.Nistand
DrandRoundVerifierinNCode.Randomness.Drandverify the documents a caller supplies, as the vendor serves
them, by the beacon's own checks against its pinned anchor, and return the pulseVerifiableRandom.Create
derives the draw from
(#3,
ADR-1013). NCode.Randomness.Nist: the NIST Randomness Beacon 2.0 beacon,AddNistBeacon(), namednist, over chain 2 of
https://beacon.nist.gov/beacon/2.0/, with settings inRandomnessBeacons:Nist
(#2,
ADR-1009).NCode.Randomness.Drand: the drand beacon,AddDrandBeacon(), nameddrand, over the League of Entropy's quicknet
chain, with settings inRandomnessBeacons:Drand
(#2,
ADR-1010).- The CURBy and NIST adapters fetch each chain or certificate once for every caller, under its own 30-second timeout,
and remember a failed fetch forRandomnessBeacons:Curby:ChainRetryDelayor
RandomnessBeacons:Nist:CertificateRetryDelay(default 1 minute) before they try it again. - The
NCode.Randomnesspackage's readme links each beacon adapter package on nuget.org.
Security
- Beacon pulses are only additional input to the secure generator, so its output is at least as unpredictable as the
operating system's generator, whatever a beacon publishes. - CURBy pulses, fetched or supplied to
CurbyPulseVerifier, are verified before use: the chain hashes to a pinned
content identifier, every document hashes to its content identifier and has only the members Twine defines, every
signature is canonical RS256 by the chain's key, and every salt matches its precommitment, so no server can change
a pulse's randomness without breaking a check
(#3,
ADR-1013). - CURBy-Q rounds, fetched or supplied to
CurbyQuantumRoundVerifier, are verified before use: the chain hashes to a
pinned content identifier, every pulse of the round is signed by its key and follows the one before, a pulse of the
pinned Bell chain answers the request with the precommitted data hash before the precommit, and the seed expands by
SHAKE256 from the seed-chain pulse after the precommit to the parameters the round commits to. The Bell-test
certificate and the Trevisan extraction are verified only out of process, by CURBy'scurby_verify
(#1,
#3,
ADR-1007,
ADR-1013). - NIST pulses, fetched or supplied to
NistPulseVerifier, are verified before use: the certificate hashes to a pinned
identifier and covers the pulse's timestamp, the RSA signature verifies over the pulse's signed fields, the output
value is the hash of those fields and the signature, and the pulse chains to its predecessor's output and matches its
precommitment
(#2,
#3,
ADR-1009,
ADR-1013). - drand rounds, fetched or supplied to
DrandRoundVerifier, are verified before use: the BLS signature of the round
number, hashed to the curve as RFC 9380 specifies, verifies against the pinned quicknet group key, and the randomness
is the SHA-256 of that signature
(#2,
#3,
ADR-1010,
ADR-1013). - Each beacon adapter's
BaseAddressmust be an absolutehttpsURL ending in/, with no user info, query or
fragment, so no credential written into a configured address reaches a logged request. - Pulses that roll back, switch chains, reuse an accepted round with other content, or are out of date by their
timestamp are refused. - Dependency injection registers the secure generator, and
RandomnessHostexposes it, only asISecureRandom,
never as the plainIRandomSource, and a disposed generator or draw throws instead of returning bytes
(#4). - Generator state, seeds and every buffer that holds them live on the stack or in pinned memory, never in a shared
array pool, and are zeroed after use; served bytes are erased from the buffers, and state is zeroed on disposal
(ADR-1012).
v0.5.1
Added
ISecureRandom, registered byAddRandomness(): an NIST SP 800-90A HMAC_DRBG with HMAC-SHA-512 per processor,
buffered, seeded and reseeded from the operating system's CSPRNG, and reseeded with every beacon pulse mixed in, after
ReseedIntervaland afterReseedAfterBytes.SystemRandomSource.Instance: the operating system's CSPRNG as anISecureRandom.RandomnessHost, for console tools and libraries without dependency injection:RandomnessHost.CreateBuilder()
takes the options, configuration section and beaconsAddRandomness()takes,BuildAsync()validates the options
and starts the background beacon collection, andDisposeAsync()stops it and zeroes the generator's state
(#4,
ADR-1011).IRandomSourceextension members: unbiasedNextInteger<T>for every integer type frombytetoUInt128, with
or without bounds,NextDouble,NextSingle,NextBoolean,NextGuid(version 4),GetBytes,Shuffle,
GetItem,GetItems,GetStringandAsRandom.IRandomnessBeaconandBeaconPulse, the port a beacon adapter implements, registered withAddBeacon<TBeacon>().- A background beacon collector with
Continuous,InitializeOnlyandOfflinemodes, per-fetch timeouts,
exponential back-off with jitter, an optionalRequireInitialPulsestart check, and a pulse age limit per beacon,
MaxPulseAgeByBeacon(ADR-1008). IBeaconStatus, the health checkAddRandomnessBeacons(), and the metricsncode.randomness.beacon.pulsesand
ncode.randomness.generator.reseeds.- Reproducible draws:
IVerifiableRandomFactoryandVerifiableRandom, algorithmncode-randomness-draw/1, specified
indocs/draws.mdwith a reference implementation. NCode.Randomness.Curby: the CURBy beacon,AddCurbyBeacon(), over the CURBy-RNG Twine chain, and the CURBy-Q
beacon,AddCurbyQuantumBeacon(), namedcurby-q, over the rounds of the CURBy-Q (DIRNG) chain, with settings in
RandomnessBeacons:Curby
(#1,
ADR-1007).- Offline verifiers that check a published draw without the network:
CurbyPulseVerifierand
CurbyQuantumRoundVerifierinNCode.Randomness.Curby,NistPulseVerifierinNCode.Randomness.Nistand
DrandRoundVerifierinNCode.Randomness.Drandverify the documents a caller supplies, as the vendor serves
them, by the beacon's own checks against its pinned anchor, and return the pulseVerifiableRandom.Create
derives the draw from
(#3,
ADR-1013). NCode.Randomness.Nist: the NIST Randomness Beacon 2.0 beacon,AddNistBeacon(), namednist, over chain 2 of
https://beacon.nist.gov/beacon/2.0/, with settings inRandomnessBeacons:Nist
(#2,
ADR-1009).NCode.Randomness.Drand: the drand beacon,AddDrandBeacon(), nameddrand, over the League of Entropy's quicknet
chain, with settings inRandomnessBeacons:Drand
(#2,
ADR-1010).- The CURBy and NIST adapters fetch each chain or certificate once for every caller, under its own 30-second timeout,
and remember a failed fetch forRandomnessBeacons:Curby:ChainRetryDelayor
RandomnessBeacons:Nist:CertificateRetryDelay(default 1 minute) before they try it again. - The
NCode.Randomnesspackage's readme links each beacon adapter package on nuget.org.
Security
- Beacon pulses are only additional input to the secure generator, so its output is at least as unpredictable as the
operating system's generator, whatever a beacon publishes. - CURBy pulses, fetched or supplied to
CurbyPulseVerifier, are verified before use: the chain hashes to a pinned
content identifier, every document hashes to its content identifier and has only the members Twine defines, every
signature is canonical RS256 by the chain's key, and every salt matches its precommitment, so no server can change
a pulse's randomness without breaking a check
(#3,
ADR-1013). - CURBy-Q rounds, fetched or supplied to
CurbyQuantumRoundVerifier, are verified before use: the chain hashes to a
pinned content identifier, every pulse of the round is signed by its key and follows the one before, a pulse of the
pinned Bell chain answers the request with the precommitted data hash before the precommit, and the seed expands by
SHAKE256 from the seed-chain pulse after the precommit to the parameters the round commits to. The Bell-test
certificate and the Trevisan extraction are verified only out of process, by CURBy'scurby_verify
(#1,
#3,
ADR-1007,
ADR-1013). - NIST pulses, fetched or supplied to
NistPulseVerifier, are verified before use: the certificate hashes to a pinned
identifier and covers the pulse's timestamp, the RSA signature verifies over the pulse's signed fields, the output
value is the hash of those fields and the signature, and the pulse chains to its predecessor's output and matches its
precommitment
(#2,
#3,
ADR-1009,
ADR-1013). - drand rounds, fetched or supplied to
DrandRoundVerifier, are verified before use: the BLS signature of the round
number, hashed to the curve as RFC 9380 specifies, verifies against the pinned quicknet group key, and the randomness
is the SHA-256 of that signature
(#2,
#3,
ADR-1010,
ADR-1013). - Each beacon adapter's
BaseAddressmust be an absolutehttpsURL ending in/, with no user info, query or
fragment, so no credential written into a configured address reaches a logged request. - Pulses that roll back, switch chains, reuse an accepted round with other content, or are out of date by their
timestamp are refused. - Dependency injection registers the secure generator, and
RandomnessHostexposes it, only asISecureRandom,
never as the plainIRandomSource, and a disposed generator or draw throws instead of returning bytes
(#4). - Generator state, seeds and every buffer that holds them live on the stack or in pinned memory, never in a shared
array pool, and are zeroed after use; served bytes are erased from the buffers, and state is zeroed on disposal
(ADR-1012).
v0.5.0
Added
ISecureRandom, registered byAddRandomness(): an NIST SP 800-90A HMAC_DRBG with HMAC-SHA-512 per processor,
buffered, seeded and reseeded from the operating system's CSPRNG, and reseeded with every beacon pulse mixed in, after
ReseedIntervaland afterReseedAfterBytes.SystemRandomSource.Instance: the operating system's CSPRNG as anISecureRandom.RandomnessHost, for console tools and libraries without dependency injection:RandomnessHost.CreateBuilder()
takes the options, configuration section and beaconsAddRandomness()takes,BuildAsync()validates the options
and starts the background beacon collection, andDisposeAsync()stops it and zeroes the generator's state
(#4,
ADR-1011).IRandomSourceextension members: unbiasedNextInteger<T>for every integer type frombytetoUInt128, with
or without bounds,NextDouble,NextSingle,NextBoolean,NextGuid(version 4),GetBytes,Shuffle,
GetItem,GetItems,GetStringandAsRandom.IRandomnessBeaconandBeaconPulse, the port a beacon adapter implements, registered withAddBeacon<TBeacon>().- A background beacon collector with
Continuous,InitializeOnlyandOfflinemodes, per-fetch timeouts,
exponential back-off with jitter, an optionalRequireInitialPulsestart check, and a pulse age limit per beacon,
MaxPulseAgeByBeacon(ADR-1008). IBeaconStatus, the health checkAddRandomnessBeacons(), and the metricsncode.randomness.beacon.pulsesand
ncode.randomness.generator.reseeds.- Reproducible draws:
IVerifiableRandomFactoryandVerifiableRandom, algorithmncode-randomness-draw/1, specified
indocs/draws.mdwith a reference implementation. NCode.Randomness.Curby: the CURBy beacon,AddCurbyBeacon(), over the CURBy-RNG Twine chain, and the CURBy-Q
beacon,AddCurbyQuantumBeacon(), namedcurby-q, over the rounds of the CURBy-Q (DIRNG) chain, with settings in
RandomnessBeacons:Curby
(#1,
ADR-1007).- Offline verifiers that check a published draw without the network:
CurbyPulseVerifierand
CurbyQuantumRoundVerifierinNCode.Randomness.Curby,NistPulseVerifierinNCode.Randomness.Nistand
DrandRoundVerifierinNCode.Randomness.Drandverify the documents a caller supplies, as the vendor serves
them, by the beacon's own checks against its pinned anchor, and return the pulseVerifiableRandom.Create
derives the draw from
(#3,
ADR-1013). NCode.Randomness.Nist: the NIST Randomness Beacon 2.0 beacon,AddNistBeacon(), namednist, over chain 2 of
https://beacon.nist.gov/beacon/2.0/, with settings inRandomnessBeacons:Nist
(#2,
ADR-1009).NCode.Randomness.Drand: the drand beacon,AddDrandBeacon(), nameddrand, over the League of Entropy's quicknet
chain, with settings inRandomnessBeacons:Drand
(#2,
ADR-1010).- The CURBy and NIST adapters fetch each chain or certificate once for every caller, under its own 30-second timeout,
and remember a failed fetch forRandomnessBeacons:Curby:ChainRetryDelayor
RandomnessBeacons:Nist:CertificateRetryDelay(default 1 minute) before they try it again.
Security
- Beacon pulses are only additional input to the secure generator, so its output is at least as unpredictable as the
operating system's generator, whatever a beacon publishes. - CURBy pulses, fetched or supplied to
CurbyPulseVerifier, are verified before use: the chain hashes to a pinned
content identifier, every document hashes to its content identifier and has only the members Twine defines, every
signature is canonical RS256 by the chain's key, and every salt matches its precommitment, so no server can change
a pulse's randomness without breaking a check
(#3,
ADR-1013). - CURBy-Q rounds, fetched or supplied to
CurbyQuantumRoundVerifier, are verified before use: the chain hashes to a
pinned content identifier, every pulse of the round is signed by its key and follows the one before, a pulse of the
pinned Bell chain answers the request with the precommitted data hash before the precommit, and the seed expands by
SHAKE256 from the seed-chain pulse after the precommit to the parameters the round commits to. The Bell-test
certificate and the Trevisan extraction are verified only out of process, by CURBy'scurby_verify
(#1,
#3,
ADR-1007,
ADR-1013). - NIST pulses, fetched or supplied to
NistPulseVerifier, are verified before use: the certificate hashes to a pinned
identifier and covers the pulse's timestamp, the RSA signature verifies over the pulse's signed fields, the output
value is the hash of those fields and the signature, and the pulse chains to its predecessor's output and matches its
precommitment
(#2,
#3,
ADR-1009,
ADR-1013). - drand rounds, fetched or supplied to
DrandRoundVerifier, are verified before use: the BLS signature of the round
number, hashed to the curve as RFC 9380 specifies, verifies against the pinned quicknet group key, and the randomness
is the SHA-256 of that signature
(#2,
#3,
ADR-1010,
ADR-1013). - Each beacon adapter's
BaseAddressmust be an absolutehttpsURL ending in/, with no user info, query or
fragment, so no credential written into a configured address reaches a logged request. - Pulses that roll back, switch chains, reuse an accepted round with other content, or are out of date by their
timestamp are refused. - Dependency injection registers the secure generator, and
RandomnessHostexposes it, only asISecureRandom,
never as the plainIRandomSource, and a disposed generator or draw throws instead of returning bytes
(#4). - Generator state, seeds and every buffer that holds them live on the stack or in pinned memory, never in a shared
array pool, and are zeroed after use; served bytes are erased from the buffers, and state is zeroed on disposal
(ADR-1012).
v0.4.1
Added
ISecureRandom, registered byAddRandomness(): an NIST SP 800-90A HMAC_DRBG with HMAC-SHA-512 per processor,
buffered, seeded and reseeded from the operating system's CSPRNG, and reseeded with every beacon pulse mixed in, after
ReseedIntervaland afterReseedAfterBytes.SystemRandomSource.Instance: the operating system's CSPRNG as anISecureRandom.RandomnessHost, for console tools and libraries without dependency injection:RandomnessHost.CreateBuilder()
takes the options, configuration section and beaconsAddRandomness()takes,BuildAsync()validates the options
and starts the background beacon collection, andDisposeAsync()stops it and zeroes the generator's state
(#4,
ADR-1011).IRandomSourceextension members: unbiasedNextInteger<T>for every integer type frombytetoUInt128, with
or without bounds,NextDouble,NextSingle,NextBoolean,NextGuid(version 4),GetBytes,Shuffle,
GetItem,GetItems,GetStringandAsRandom.IRandomnessBeaconandBeaconPulse, the port a beacon adapter implements, registered withAddBeacon<TBeacon>().- A background beacon collector with
Continuous,InitializeOnlyandOfflinemodes, per-fetch timeouts,
exponential back-off with jitter, an optionalRequireInitialPulsestart check, and a pulse age limit per beacon,
MaxPulseAgeByBeacon(ADR-1008). IBeaconStatus, the health checkAddRandomnessBeacons(), and the metricsncode.randomness.beacon.pulsesand
ncode.randomness.generator.reseeds.- Reproducible draws:
IVerifiableRandomFactoryandVerifiableRandom, algorithmncode-randomness-draw/1, specified
indocs/draws.mdwith a reference implementation. NCode.Randomness.Curby: the CURBy beacon,AddCurbyBeacon(), over the CURBy-RNG Twine chain, and the CURBy-Q
beacon,AddCurbyQuantumBeacon(), namedcurby-q, over the rounds of the CURBy-Q (DIRNG) chain, with settings in
RandomnessBeacons:Curby
(#1,
ADR-1007).NCode.Randomness.Nist: the NIST Randomness Beacon 2.0 beacon,AddNistBeacon(), namednist, over chain 2 of
https://beacon.nist.gov/beacon/2.0/, with settings inRandomnessBeacons:Nist
(#2,
ADR-1009).NCode.Randomness.Drand: the drand beacon,AddDrandBeacon(), nameddrand, over the League of Entropy's quicknet
chain, with settings inRandomnessBeacons:Drand
(#2,
ADR-1010).- The CURBy and NIST adapters fetch each chain or certificate once for every caller, under its own 30-second timeout,
and remember a failed fetch forRandomnessBeacons:Curby:ChainRetryDelayor
RandomnessBeacons:Nist:CertificateRetryDelay(default 1 minute) before they try it again.
Security
- Beacon pulses are only additional input to the secure generator, so its output is at least as unpredictable as the
operating system's generator, whatever a beacon publishes. - CURBy pulses are verified before use: the chain hashes to a pinned content identifier, every document hashes to its
content identifier and has only the members Twine defines, every signature is canonical RS256 by the chain's key,
and every salt matches its precommitment, so no server can change a pulse's randomness without breaking a check. - CURBy-Q rounds are verified before use: the chain hashes to a pinned content identifier, every pulse of the round is
signed by its key and follows the one before, a pulse of the pinned Bell chain answers the request with the
precommitted data hash before the precommit, and the seed expands by SHAKE256 from the seed-chain pulse after the
precommit to the parameters the round commits to. The Bell-test certificate and the Trevisan extraction are verified
only out of process, by CURBy'scurby_verify
(#1,
ADR-1007). - NIST pulses are verified before use: the certificate hashes to a pinned identifier and covers the pulse's timestamp,
the RSA signature verifies over the pulse's signed fields, the output value is the hash of those fields and the
signature, and the pulse chains to its predecessor's output and matches its precommitment
(#2,
ADR-1009). - drand rounds are verified before use: the BLS signature of the round number, hashed to the curve as RFC 9380
specifies, verifies against the pinned quicknet group key, and the randomness is the SHA-256 of that signature
(#2,
ADR-1010). - Each beacon adapter's
BaseAddressmust be an absolutehttpsURL ending in/, with no user info, query or
fragment, so no credential written into a configured address reaches a logged request. - Pulses that roll back, switch chains, reuse an accepted round with other content, or are out of date by their
timestamp are refused. - Dependency injection registers the secure generator, and
RandomnessHostexposes it, only asISecureRandom,
never as the plainIRandomSource, and a disposed generator or draw throws instead of returning bytes
(#4). - Generator state, seeds and every buffer that holds them live on the stack or in pinned memory, never in a shared
array pool, and are zeroed after use; served bytes are erased from the buffers, and state is zeroed on disposal
(ADR-1012).
v0.4.0
Added
ISecureRandom, registered byAddRandomness(): an NIST SP 800-90A HMAC_DRBG with HMAC-SHA-512 per processor,
buffered, seeded and reseeded from the operating system's CSPRNG, and reseeded with every beacon pulse mixed in, after
ReseedIntervaland afterReseedAfterBytes.SystemRandomSource.Instance: the operating system's CSPRNG as anISecureRandom.RandomnessHost, for console tools and libraries without dependency injection:RandomnessHost.CreateBuilder()
takes the options, configuration section and beaconsAddRandomness()takes,BuildAsync()validates the options
and starts the background beacon collection, andDisposeAsync()stops it and zeroes the generator's state
(#4,
ADR-1011).IRandomSourceextension members: unbiasedNextInteger<T>for every integer type frombytetoUInt128, with
or without bounds,NextDouble,NextSingle,NextBoolean,NextGuid(version 4),GetBytes,Shuffle,
GetItem,GetItems,GetStringandAsRandom.IRandomnessBeaconandBeaconPulse, the port a beacon adapter implements, registered withAddBeacon<TBeacon>().- A background beacon collector with
Continuous,InitializeOnlyandOfflinemodes, per-fetch timeouts,
exponential back-off with jitter, an optionalRequireInitialPulsestart check, and a pulse age limit per beacon,
MaxPulseAgeByBeacon(ADR-1008). IBeaconStatus, the health checkAddRandomnessBeacons(), and the metricsncode.randomness.beacon.pulsesand
ncode.randomness.generator.reseeds.- Reproducible draws:
IVerifiableRandomFactoryandVerifiableRandom, algorithmncode-randomness-draw/1, specified
indocs/draws.mdwith a reference implementation. NCode.Randomness.Curby: the CURBy beacon,AddCurbyBeacon(), over the CURBy-RNG Twine chain, and the CURBy-Q
beacon,AddCurbyQuantumBeacon(), namedcurby-q, over the rounds of the CURBy-Q (DIRNG) chain, with settings in
RandomnessBeacons:Curby
(#1,
ADR-1007).NCode.Randomness.Nist: the NIST Randomness Beacon 2.0 beacon,AddNistBeacon(), namednist, over chain 2 of
https://beacon.nist.gov/beacon/2.0/, with settings inRandomnessBeacons:Nist
(#2,
ADR-1009).NCode.Randomness.Drand: the drand beacon,AddDrandBeacon(), nameddrand, over the League of Entropy's quicknet
chain, with settings inRandomnessBeacons:Drand
(#2,
ADR-1010).- The CURBy and NIST adapters fetch each chain or certificate once for every caller, under its own 30-second timeout,
and remember a failed fetch forRandomnessBeacons:Curby:ChainRetryDelayor
RandomnessBeacons:Nist:CertificateRetryDelay(default 1 minute) before they try it again.
Security
- Beacon pulses are only additional input to the secure generator, so its output is at least as unpredictable as the
operating system's generator, whatever a beacon publishes. - CURBy pulses are verified before use: the chain hashes to a pinned content identifier, every document hashes to its
content identifier and has only the members Twine defines, every signature is canonical RS256 by the chain's key,
and every salt matches its precommitment, so no server can change a pulse's randomness without breaking a check. - CURBy-Q rounds are verified before use: the chain hashes to a pinned content identifier, every pulse of the round is
signed by its key and follows the one before, a pulse of the pinned Bell chain answers the request with the
precommitted data hash before the precommit, and the seed expands by SHAKE256 from the seed-chain pulse after the
precommit to the parameters the round commits to. The Bell-test certificate and the Trevisan extraction are verified
only out of process, by CURBy'scurby_verify
(#1,
ADR-1007). - NIST pulses are verified before use: the certificate hashes to a pinned identifier and covers the pulse's timestamp,
the RSA signature verifies over the pulse's signed fields, the output value is the hash of those fields and the
signature, and the pulse chains to its predecessor's output and matches its precommitment
(#2,
ADR-1009). - drand rounds are verified before use: the BLS signature of the round number, hashed to the curve as RFC 9380
specifies, verifies against the pinned quicknet group key, and the randomness is the SHA-256 of that signature
(#2,
ADR-1010). - Each beacon adapter's
BaseAddressmust be an absolutehttpsURL ending in/, with no user info, query or
fragment, so no credential written into a configured address reaches a logged request. - Pulses that roll back, switch chains, reuse an accepted round with other content, or are out of date by their
timestamp are refused. - Dependency injection registers the secure generator, and
RandomnessHostexposes it, only asISecureRandom,
never as the plainIRandomSource, and a disposed generator or draw throws instead of returning bytes
(#4). - Generator state lives in pinned memory, served bytes are erased from the buffers, and state is zeroed on disposal.
v0.3.0
Added
ISecureRandom, registered byAddRandomness(): an NIST SP 800-90A HMAC_DRBG with HMAC-SHA-512 per processor,
buffered, seeded and reseeded from the operating system's CSPRNG, and reseeded with every beacon pulse mixed in, after
ReseedIntervaland afterReseedAfterBytes.SystemRandomSource.Instance: the operating system's CSPRNG as anISecureRandom.IRandomSourceextension members: unbiasedNextInteger<T>for every integer type frombytetoUInt128, with
or without bounds,NextDouble,NextSingle,NextBoolean,NextGuid(version 4),GetBytes,Shuffle,
GetItem,GetItems,GetStringandAsRandom.IRandomnessBeaconandBeaconPulse, the port a beacon adapter implements, registered withAddBeacon<TBeacon>().- A background beacon collector with
Continuous,InitializeOnlyandOfflinemodes, per-fetch timeouts,
exponential back-off with jitter, an optionalRequireInitialPulsestart check, and a pulse age limit per beacon,
MaxPulseAgeByBeacon(ADR-1008). IBeaconStatus, the health checkAddRandomnessBeacons(), and the metricsncode.randomness.beacon.pulsesand
ncode.randomness.generator.reseeds.- Reproducible draws:
IVerifiableRandomFactoryandVerifiableRandom, algorithmncode-randomness-draw/1, specified
indocs/draws.mdwith a reference implementation. NCode.Randomness.Curby: the CURBy beacon,AddCurbyBeacon(), over the CURBy-RNG Twine chain, and the CURBy-Q
beacon,AddCurbyQuantumBeacon(), namedcurby-q, over the rounds of the CURBy-Q (DIRNG) chain, with settings in
RandomnessBeacons:Curby
(#1,
ADR-1007).NCode.Randomness.Nist: the NIST Randomness Beacon 2.0 beacon,AddNistBeacon(), namednist, over chain 2 of
https://beacon.nist.gov/beacon/2.0/, with settings inRandomnessBeacons:Nist
(#2,
ADR-1009).NCode.Randomness.Drand: the drand beacon,AddDrandBeacon(), nameddrand, over the League of Entropy's quicknet
chain, with settings inRandomnessBeacons:Drand
(#2,
ADR-1010).- The CURBy and NIST adapters fetch each chain or certificate once for every caller, under its own 30-second timeout,
and remember a failed fetch forRandomnessBeacons:Curby:ChainRetryDelayor
RandomnessBeacons:Nist:CertificateRetryDelay(default 1 minute) before they try it again.
Security
- Beacon pulses are only additional input to the secure generator, so its output is at least as unpredictable as the
operating system's generator, whatever a beacon publishes. - CURBy pulses are verified before use: the chain hashes to a pinned content identifier, every document hashes to its
content identifier and has only the members Twine defines, every signature is canonical RS256 by the chain's key,
and every salt matches its precommitment, so no server can change a pulse's randomness without breaking a check. - CURBy-Q rounds are verified before use: the chain hashes to a pinned content identifier, every pulse of the round is
signed by its key and follows the one before, a pulse of the pinned Bell chain answers the request with the
precommitted data hash before the precommit, and the seed expands by SHAKE256 from the seed-chain pulse after the
precommit to the parameters the round commits to. The Bell-test certificate and the Trevisan extraction are verified
only out of process, by CURBy'scurby_verify
(#1,
ADR-1007). - NIST pulses are verified before use: the certificate hashes to a pinned identifier and covers the pulse's timestamp,
the RSA signature verifies over the pulse's signed fields, the output value is the hash of those fields and the
signature, and the pulse chains to its predecessor's output and matches its precommitment
(#2,
ADR-1009). - drand rounds are verified before use: the BLS signature of the round number, hashed to the curve as RFC 9380
specifies, verifies against the pinned quicknet group key, and the randomness is the SHA-256 of that signature
(#2,
ADR-1010). - Each beacon adapter's
BaseAddressmust be an absolutehttpsURL ending in/, with no user info, query or
fragment, so no credential written into a configured address reaches a logged request. - Pulses that roll back, switch chains, reuse an accepted round with other content, or are out of date by their
timestamp are refused. - Dependency injection registers the secure generator only as
ISecureRandom, never as the plainIRandomSource, and
a disposed generator or draw throws instead of returning bytes. - Generator state lives in pinned memory, served bytes are erased from the buffers, and state is zeroed on disposal.
v0.2.0
Added
ISecureRandom, registered byAddRandomness(): an NIST SP 800-90A HMAC_DRBG with HMAC-SHA-512 per processor,
buffered, seeded and reseeded from the operating system's CSPRNG, and reseeded with every beacon pulse mixed in, after
ReseedIntervaland afterReseedAfterBytes.SystemRandomSource.Instance: the operating system's CSPRNG as anISecureRandom.IRandomSourceextension members: unbiasedNextInteger<T>for every integer type frombytetoUInt128, with
or without bounds,NextDouble,NextSingle,NextBoolean,NextGuid(version 4),GetBytes,Shuffle,
GetItem,GetItems,GetStringandAsRandom.IRandomnessBeaconandBeaconPulse, the port a beacon adapter implements, registered withAddBeacon<TBeacon>().- A background beacon collector with
Continuous,InitializeOnlyandOfflinemodes, per-fetch timeouts,
exponential back-off with jitter, an optionalRequireInitialPulsestart check, and a pulse age limit per beacon,
MaxPulseAgeByBeacon(ADR-1008). IBeaconStatus, the health checkAddRandomnessBeacons(), and the metricsncode.randomness.beacon.pulsesand
ncode.randomness.generator.reseeds.- Reproducible draws:
IVerifiableRandomFactoryandVerifiableRandom, algorithmncode-randomness-draw/1, specified
indocs/draws.mdwith a reference implementation. NCode.Randomness.Curby: the CURBy beacon,AddCurbyBeacon(), over the CURBy-RNG Twine chain, and the CURBy-Q
beacon,AddCurbyQuantumBeacon(), namedcurby-q, over the rounds of the CURBy-Q (DIRNG) chain, with settings in
RandomnessBeacons:Curby
(#1,
ADR-1007).
Security
- Beacon pulses are only additional input to the secure generator, so its output is at least as unpredictable as the
operating system's generator, whatever a beacon publishes. - CURBy pulses are verified before use: the chain hashes to a pinned content identifier, every document hashes to its
content identifier and has only the members Twine defines, every signature is canonical RS256 by the chain's key,
and every salt matches its precommitment, so no server can change a pulse's randomness without breaking a check. - CURBy-Q rounds are verified before use: the chain hashes to a pinned content identifier, every pulse of the round is
signed by its key and follows the one before, a pulse of the pinned Bell chain answers the request with the
precommitted data hash before the precommit, and the seed expands by SHAKE256 from the seed-chain pulse after the
precommit to the parameters the round commits to. The Bell-test certificate and the Trevisan extraction are verified
only out of process, by CURBy'scurby_verify
(#1,
ADR-1007). - Pulses that roll back, switch chains, reuse an accepted round with other content, or are out of date by their
timestamp are refused. - Dependency injection registers the secure generator only as
ISecureRandom, never as the plainIRandomSource, and
a disposed generator or draw throws instead of returning bytes. - Generator state lives in pinned memory, served bytes are erased from the buffers, and state is zeroed on disposal.