Created
October 21, 2016 09:57
-
-
Save msm-code/e6521eab8028dfd1032f8842f95636e4 to your computer and use it in GitHub Desktop.
paper.python.3c816792f60044320ba90ebb036db304
This file contains hidden or 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
| def nymaim_decrypt(self, raw, from_raw, length): | |
| from_va = from_raw + self.image_base | |
| xsize = from_va - self.off | |
| cur_key = self.key | |
| if xsize < 0: | |
| raise RuntimeError("raw too small - min is " + hex(self.off - self.image_base)) | |
| for _ in range(xsize / 4): | |
| cur_key = (cur_key + self.xstep) & 0xffffffff | |
| r = '' | |
| length = min(length, len(raw) - from_raw) | |
| for i in range(length): | |
| r += chr(raw[from_raw + i] ^ (ror(cur_key, (xsize & 3) * 8) & 0xff)) | |
| xsize += 1 | |
| if xsize % 4 == 0: | |
| cur_key = (cur_key + self.xstep) & 0xffffffff | |
| return r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment