Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import hashlib
- import sys
- def xor(a, b):
- return "".join([chr(ord(a[i]) ^ ord(b[i % len(b)])) for i in xrange(len(a))])
- def derive(i):
- return hashlib.sha256(str(i)).digest()
- def decrypt(msg, key):
- iv = msg[:8]
- msg = msg[8:]
- stream = hashlib.sha256(iv + key).digest()
- stream = hashlib.sha256(stream + iv + key).digest()
- cipher = xor(msg, stream)
- return cipher
- sa = set()
- sb = set()
- ea = "e86e73ce95d5be01428522838f464257af5f3f97577226b8ce".decode("hex")
- eb = "d4c17fa1087b1bedca95579b783c43a8b5a18156036f36bbe8".decode("hex")
- for i in xrange(100000) :
- key = derive(i)
- sa.add(decrypt(ea, key))
- sb.add(decrypt(eb, key))
- if sa & sb :
- print (sa & sb).pop()
- sys.exit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement