MCPcopy Create free account
hub / github.com/ElementsProject/elements / SeedFast

Function SeedFast

src/random.cpp:460–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458}
459
460static void SeedFast(CSHA512& hasher) noexcept
461{
462 unsigned char buffer[32];
463
464 // Stack pointer to indirectly commit to thread/callstack
465 const unsigned char* ptr = buffer;
466 hasher.Write((const unsigned char*)&ptr, sizeof(ptr));
467
468 // Hardware randomness is very fast when available; use it always.
469 SeedHardwareFast(hasher);
470
471 // High-precision timestamp
472 SeedTimestamp(hasher);
473}
474
475static void SeedSlow(CSHA512& hasher, RNGState& rng) noexcept
476{

Callers 3

SeedSlowFunction · 0.85
SeedPeriodicFunction · 0.85
ProcRandFunction · 0.85

Calls 3

SeedHardwareFastFunction · 0.85
SeedTimestampFunction · 0.85
WriteMethod · 0.45

Tested by

no test coverage detected