Advertisement
Guest User

Untitled

a guest
Sep 11th, 2017
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. KEY = 'musZTXmxV58UdwiKt8Tp'
  2.  
  3. def xor_str(x, y):
  4. if len(x) > len(y):
  5. return ''.join([chr(ord(z) ^ ord(p)) for (z, p) in zip(x[:len(y)], y)])
  6. else:
  7. return ''.join([chr(ord(z) ^ ord(p)) for (z, p) in zip(x, y[:len(x)])])
  8.  
  9. key = KEY.encode('hex')
  10. cipher = open('flag.enc','r').read()
  11. dec = xor_str(key*632,cipher)
  12. file = open('flag.png' ,'w')
  13. file.write(dec.decode('hex'))
  14. file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement