Closed P2Poker closed 6 years ago
@P2Poker ,
What is the problem? What problem are you trying to solve?
Most of the computation effort is expended in GenerateBlock
and/or GenerateIntoBufferedTransformation
, which produces the random number stream. The work is due to AES.
The system time is added to reduce the risk of state playback attacks in virtual machines. Also see the head notes at RandomPool Class Reference.
The memory for the key and seed are not contiguous. From randpool.h
:
FixedSizeAlignedSecBlock<byte, 16, true> m_seed;
FixedSizeAlignedSecBlock<byte, 32> m_key;
member_ptr<BlockCipher> m_pCipher;
bool m_keySet;
@noloader Thanks for the info.
SHA256 just seemed like a little bit of a waste, since 256-bit AES expects 384 bits of input.
There is no problem, this isn't a bugfix. I just figure this would complete the picture, round out the algorithm, add a little more robustness, collect an extra initial 128-bits of entropy from the OS when auto-seeding, etc.
All of these things seem ultimately desirable, even if minor.
I figure, if the upgrade is this easy, let's just get it over with. I'll do some more work on this today, between other tasks.
Thanks @P2Poker.
I think we are going to pass on the PR. I prefer not to disturb the underlying RandomNumberGenerator
interface. And while not readily apparent, the switch from SHA-256 to SHA-512 is a lot slower on some platforms. That's because we have SHA-256 intrinsics on Intel, ARM and Power8 machines.
Reason: more entropy Difficulty: pretty easy Risk: minimal
TODO:
Theoretical example of possible modifications:
Thoughts: