3 ms·
Weirdly, I answered almost exactly the same “invert the RNG” question on StackOverflow (https://stackoverflow.com/a/15237585/1204143 https://stackoverflow.com/a
by nneonneo 3y ago
Weirdly, I answered almost exactly the same “invert the RNG” question on StackOverflow (https://stackoverflow.com/a/15237585/1204143 https://stackoverflow.com/a/15237585/1204143) just a few months before you posted your question to Crypto.SE, except that I attacked the Java RNG instead of the MSVC RNG. They both use a simple LCG design where outputs are truncations of the internal state, so the attacks are very similar to each other.
- hayley-patton 3y agoI'm not very good at maths so I let Z3 work out some convenient seeds for me, leading to import java.util.Random; public class Hayley { public static void main(String... args) { byte[] b1 = new byte[4], b2 = new byte[2]; (new Random(0x2effe2140e00L)).nextBytes(b1); (new Random(0xc2f0097)).nextBytes(b2); System.out.println(new String(b1) + new String(b2)); } }