* Feed (the hash of) all events added through AddEvent() to hasher. */
| 388 | * Feed (the hash of) all events added through AddEvent() to hasher. |
| 389 | */ |
| 390 | void SeedEvents(CSHA512& hasher) noexcept |
| 391 | { |
| 392 | // We use only SHA256 for the events hashing to get the ASM speedups we have for SHA256, |
| 393 | // since we want it to be fast as network peers may be able to trigger it repeatedly. |
| 394 | LOCK(m_events_mutex); |
| 395 | |
| 396 | unsigned char events_hash[32]; |
| 397 | m_events_hasher.Finalize(events_hash); |
| 398 | hasher.Write(events_hash, 32); |
| 399 | |
| 400 | // Re-initialize the hasher with the finalized state to use later. |
| 401 | m_events_hasher.Reset(); |
| 402 | m_events_hasher.Write(events_hash, 32); |
| 403 | } |
| 404 | |
| 405 | /** Extract up to 32 bytes of entropy from the RNG state, mixing in new entropy from hasher. |
| 406 | * |
no test coverage detected