Created
October 21, 2016 09:53
-
-
Save msm-code/85df4aaa28a8adbf324f0d55bec3253b to your computer and use it in GitHub Desktop.
paper.python.aff86e72b5462bf8d858196af5f88ea2
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(key, raw_bytes): | |
| nibble0 = raw_bytes[0] & 0xF | |
| nibble1 = raw_bytes[1] & 0xF | |
| salt = raw_bytes[2:2+nibble0] | |
| password = key + salt | |
| data = raw_bytes[2+nibble0:len(raw_bytes)-nibble1] | |
| decrypted = rc4_decrypt(password, body) | |
| decrypted_len = struct.unpack('<I', decrypted[:4])[0] | |
| assert decrypted_len == len(decrypted - 4) | |
| return decrypted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment