2020. 3. 1. 17:41ㆍ카테고리 없음
$ pip install randcrack How it worksThe generator is based upon Mersenne Twister, which is able to generate numbers with excellent statistical properties(indistinguishable from truly random). However, this generator was not designed to be cryptographycally secure. You should NEVER use in critical applications as a PRNG for your crypto scheme.You can learn more about this generator.This cracker works as the following way. It obtains first 624 32 bit numbers from the generator and obtains the most likely state of Mersenne Twister matrix, which is the internal state. From this point generator should be synchronized with the cracker. How to useIt is important to feed cracker exactly 32-bit integers generated by the generator due to the fact that they will be generated anyway, but dropped if you don't request for them.As well, you must feed the cracker exactly after new seed is presented, or after 624.32 bits are generated since every 624 32-bit numbers generator shifts it's state and cracker is designed to be fed from the begining of some state. Implemented methodsCracker has one method for feeding: submit(n).
Mersenne Twister Python
After submitting 624 integers it won't take any more and will be ready for predicting new numbers.Cracker can predict new numbers with following methods, which work exactly the same as their siblings from the random module but without predict prefix. These are: predictgetrandbits, predictrandbelow, predictrandrange, predictrandint and predictchoiceNote: Cracker does not implement prediction of random function since it is based on the os.urandom module which is based on /dev/urandom.Here's an example usage.