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

Function SeedHardwareFast

src/random.cpp:188–196  ·  view source on GitHub ↗

Add 64 bits of entropy gathered from hardware to hasher. Do nothing if not supported. */

Source from the content-addressed store, hash-verified

186
187/** Add 64 bits of entropy gathered from hardware to hasher. Do nothing if not supported. */
188static void SeedHardwareFast(CSHA512& hasher) noexcept {
189#if defined(__x86_64__) || defined(__amd64__) || defined(__i386__)
190 if (g_rdrand_supported) {
191 uint64_t out = GetRdRand();
192 hasher.Write((const unsigned char*)&out, sizeof(out));
193 return;
194 }
195#endif
196}
197
198/** Add 256 bits of entropy gathered from hardware to hasher. Do nothing if not supported. */
199static void SeedHardwareSlow(CSHA512& hasher) noexcept {

Callers 1

SeedFastFunction · 0.85

Calls 2

GetRdRandFunction · 0.85
WriteMethod · 0.45

Tested by

no test coverage detected