2
$\begingroup$

Pardon me for this newbie-ish question. I'm still a novice in cryptography . I have an application that outputs random numbers from 0 - 12 (endpoints inclusive) unsequentially (some outputs are thrown off) using the mersenne twister algorithm and i would like to break and predict its seed in Python but i don't know what to program?

Once again please pardon my little knowledge in this space.

$\endgroup$
3
  • $\begingroup$ Are you taking the twister outputs modulo 13? $\endgroup$ – Adrian Self Jun 16 '20 at 3:51
  • $\begingroup$ Or if you don't know implementation, what method call are you making in python? $\endgroup$ – Adrian Self Jun 17 '20 at 15:14
  • $\begingroup$ i use random.randint(0, 12) $\endgroup$ – Ozichukwu Jun 21 '20 at 11:49
0
$\begingroup$

If you can identify which outputs are revealed and which are thrown off (ex. every other output is thrown off), you may be able to successfully analyze the twister so that you can predict future outputs.

However, the bigger problem here is that you are limiting outputs to the range [0,12]. With a 32 or 64 bit word length, a set of numbers in that range will not reveal nearly enough information about the state (even if none were discarded and all outputs were revealed to you).

$\endgroup$
5
  • $\begingroup$ it's not just one number. it's a series of unsequential outputs in range 0 - 12 $\endgroup$ – Ozichukwu Jun 16 '20 at 14:35
  • $\begingroup$ Yes, this answer takes that into account. I will edit the wording so it is more clear. Do you understand the issues at hand? $\endgroup$ – Adrian Self Jun 17 '20 at 15:12
  • $\begingroup$ I have 1665 of such outputs which is enough. My problem in all this is that i understand the theory (beginner level) but i have no idea what to code $\endgroup$ – Ozichukwu Jun 21 '20 at 11:48
  • $\begingroup$ "With a 32 or 64 bit word length, a set of numbers in that range will not reveal nearly enough information about the state"; that depends on the mapping between the 32 bit outputs and the value [0,12]. If the mapping is $\lfloor n / (2^{32}/13) \rfloor$, that gives you the msbit sometimes, which is quite enough. If it's $n \bmod 13$, well, there's no immediate way to attack that $\endgroup$ – poncho Nov 14 '20 at 17:10
  • $\begingroup$ Correction: it's not quite enough with only 1665 outputs; rather more would be required... $\endgroup$ – poncho Nov 14 '20 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.