Skip to content

Instantly share code, notes, and snippets.

@balidani
Created May 19, 2014 01:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balidani/e8212c3142c28238db6e to your computer and use it in GitHub Desktop.
Save balidani/e8212c3142c28238db6e to your computer and use it in GitHub Desktop.
import socket
import time
seed = "FC8A4551678CA9C0B0FDF76FB850F12F7A6266E3D3C36EBE373933683BC6761EAEAA83ED571AF129E6C1B99EDDA2862C1ADC499D8201D53AB5D333121CCE942BC3B06CBC4673395E7BC7B49E56F0AD725E83C705C5E92E85887994F7E7AC34FE5CCE2E13F1CC8EEA6083BEDC4ABBE8DF6520EF44ADFAD61283D5DC94AD1FE15FE8FA7E3FDA61E3DFAB5B4F2A6C2482AD1789BA29B946347464F745228DAF33D652B5DE10E4535D96B7E22ECBB175BC745A21298C57B3165EC7C8C22635482D3C607B5DDDA8296119D0EFEE6D04DD2051951D01E1DADAB4A546D9CBAF56B52005D06BD222212F2DD373975689AEAC02B635D21487C649DF0E178564E5AF6E9361".decode('hex')
count_max = 0x7e0 - 0x20
def calc4(buf, arg2):
res = 0
for arg3 in range(4):
res |= calc(buf, arg2, arg3)
return res
def calc(buf, arg2, arg3):
shift = arg2 >> 3
w = arg2 & 7
v1 = ord(buf[shift + arg3])
esi = v1 << w
v2 = ord(buf[shift + arg3 + 1])
edx = v2 >> (8 - w)
eax = (esi | edx) & 0xff
eax = eax << [24, 16, 8, 0][arg3]
return eax
def loop(count, buf):
output = []
for c1 in xrange(count):
res1 = calc4(buf, c1)
for c2 in xrange(count):
res2 = calc4(buf, c2)
res = res1 ^ res2
output.append((res >> 24) & 0xff)
output.append((res >> 16) & 0xff)
output.append((res >> 8) & 0xff)
output.append((res >> 0) & 0xff)
return output
big_seed = loop(count_max, seed)
open('seed2', 'wb').write(''.join(map(chr, big_seed)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment