Skip to content

Instantly share code, notes, and snippets.

Created November 20, 2022 23:35
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
as seen in 96baba74a907890b995f23c7db21568f7bfb5dbf417ed90ca311482b99702b72
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import binascii
def decrypt(buf: bytes, key: int, summand: int) -> str:
ret = bytearray()
for i, c in enumerate(buf):
ret.append(c ^ key)
key += (-1 if i % 2 else 1) + summand
key &= 0xff
return ret.decode('utf-8').rstrip('\0')
if __name__ == '__main__':
assert decrypt(binascii.unhexlify(b'8797286a6da3f032539eb4'), 0xe4, -0x38) == r'c:\Windows'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment