Skip to content

Instantly share code, notes, and snippets.

@ymgve
Created April 1, 2017 22:01
Show Gist options
  • Save ymgve/749972c45c835a1789fca0055e3bd7d7 to your computer and use it in GitHub Desktop.
Save ymgve/749972c45c835a1789fca0055e3bd7d7 to your computer and use it in GitHub Desktop.
import struct
s = "W"
x = 0xDEADBEEF
for n in 0x0FF6FEAFE, 0x0CDAF4DB6, 0x8D9A9B17, 0x83A147A7, 0x7AD24DCA, 0x0C99CA1B9, 0x71CEAC15, 0x932C2931:
x ^= n
s += struct.pack("<I", x)
x = n
s2 = "W"
prev = ord(s[0])
for c in s[1:]:
c = ord(c)
if prev & 1 == 0:
s2 += chr((c - prev) & 0xff)
else:
s2 += chr((c + prev) & 0xff)
prev = c
print repr(s2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment