# larsborn/tofsee_string_decrpyt.py **[gist.github.com/larsborn/0ec24d7b294248c51de0c3335802cbd4](https://gist.github.com/larsborn/0ec24d7b294248c51de0c3335802cbd4)** ## Instantly share code, notes, and snippets. 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](https://gist.github.com/join?source=comment-gist) in to comment -----