altf4 / untwister

Seed recovery tool for PRNGs
GNU General Public License v3.0
359 stars 42 forks source link

Question on how to set up cracking on java doubles? #45

Open sonhnguyenn opened 4 years ago

sonhnguyenn commented 4 years ago

I am wondering how can I set this up to run on a set of floats? In java code is .nextDouble(), which is a float between 0 and 1.

altf4 commented 4 years ago

Looks like it wouldn't be too hard to support? Maybe the implementation depends on the actual JRE though. Not sure about that.

http://developer.classpath.org/doc/java/util/Random-source.html

369: public double nextDouble() 370: { 371: return (((long) next(26) << 27) + next(27)) / (double) (1L << 53); 372: }

and you can see that the next(int) function is the same as untwister's Java::next(int)