Created
November 20, 2022 23:35
-
-
Save larsborn/0ec24d7b294248c51de0c3335802cbd4 to your computer and use it in GitHub Desktop.
as seen in 96baba74a907890b995f23c7db21568f7bfb5dbf417ed90ca311482b99702b72
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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