Skip to content

Instantly share code, notes, and snippets.

@AndyNovo
Last active October 21, 2016 15:58
Show Gist options
  • Save AndyNovo/b7ea35fb9ed098560af2cd8374dd86ec to your computer and use it in GitHub Desktop.
Save AndyNovo/b7ea35fb9ed098560af2cd8374dd86ec to your computer and use it in GitHub Desktop.
R=IntegerModRing(2**32)
def breaker(rands):
inv_c = [0, -55, 0, 0, 165, 0, 0, -330, 0, 0, 462, 0, 0, -462, 0, 0, 330, 0, 0, -165, 0, 0, 55, 1, 0, -11, -12, 0, 1, 11, 0]
for i in range(2**13):
m2s = Integer(i).digits(base=2, padto=13)
seed = R(0)
index2s = 0
for i in range(31):
if inv_c[i] != 0:
seed += R((rands[i]*2 + m2s[index2s])*inv_c[i])
index2s += 1
guess = pseudo_rand(seed, 31)
if guess == rands:
print "FOUND THE SEED: ", seed
return seed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment