I have an application that needs long random bit sequences.
Because I rely on these sequences being "truly random", I want to use SecureRandom.
Sadly, I need each such sequence twice.
I cannot keep them in the RAM, because they're too long.
I don't want to write them to the Hard Drive, because writing to and reading from the Hard Drive costs time and Hard Drive space and makes the code unnecessarily complex.
However, since the "random" bit sequence generated by some Generator deterministically depends on the state the Generator was in when it was created, one (maybe) may be able to save and recreate the state a newly generated SecureRandom object was in, allowing for recreation of the bit sequence.
The main question is:
(How) Can you save the entire state of a SecureRandom random number generator? Is cloning enough? (there could be some OS states that also play a role, for example, the current time)
Also, I'm interested in what sorts of patterns the normal Random number generators create, making them insecure, and whether one can save and recover their state as described above.
Aucun commentaire:
Enregistrer un commentaire