Skip to content

Instantly share code, notes, and snippets.

@ius
Created October 3, 2019 18: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 ius/decb73bf9749915d3368218d00eed20c to your computer and use it in GitHub Desktop.
Save ius/decb73bf9749915d3368218d00eed20c to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import struct
import sys
def xor(a, b):
return bytes(x ^ y for x, y in zip(a, b))
def cipher_stream(state, length):
output = b''
for i in range(0, length, 4):
output += struct.pack('>I', state)
state = (state + (state >> 0x1a | state << 0xe)) & 0xffffffff
return output[:length]
state = 0x967e9839
brd = open(sys.argv[1], 'rb').read()
data = xor(brd, cipher_stream(state, len(brd)))
open(sys.argv[2], 'wb').write(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment