MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / SeedStartup

Function SeedStartup

src/random.cpp:536–554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534}
535
536void SeedStartup(CSHA512& hasher, RNGState& rng) noexcept
537{
538 // Gather 256 bits of hardware randomness, if available
539 SeedHardwareSlow(hasher);
540
541 // Everything that the 'slow' seeder includes.
542 SeedSlow(hasher, rng);
543
544 // Dynamic environment data (clocks, resource usage, ...)
545 auto old_size = hasher.Size();
546 RandAddDynamicEnv(hasher);
547
548 // Static environment data
549 RandAddStaticEnv(hasher);
550 LogDebug(BCLog::RAND, "Feeding %i bytes of environment data into RNG\n", hasher.Size() - old_size);
551
552 // Strengthen for 100 ms
553 SeedStrengthen(hasher, rng, 100ms);
554}
555
556enum class RNGLevel {
557 FAST, //!< Automatically called by GetRandBytes

Callers 1

ProcRandFunction · 0.85

Calls 6

SeedHardwareSlowFunction · 0.85
SeedSlowFunction · 0.85
RandAddDynamicEnvFunction · 0.85
RandAddStaticEnvFunction · 0.85
SeedStrengthenFunction · 0.85
SizeMethod · 0.45

Tested by

no test coverage detected