Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

vim_blowfish_decrypt.py

By: a guest on Jan 3rd, 2014  |  syntax: Python  |  size: 0.54 KB  |  views: 32  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. with open("test_known.txt") as f:
  2.     with open("test.txt", 'rb') as e:
  3.         i,j = 0,0
  4.         e.seek(28)
  5.         output = ""
  6.         pad = [0,0,0,0,0,0,0,0]
  7.         for char in f.read():
  8.             if j == 0:
  9.                 char2 = e.read(1)
  10.                 pad[i] = ord(char) ^ ord(char2)
  11.                 output += chr(pad[i] ^ ord(char2))
  12.             else:
  13.                 output += chr(pad[i] ^ ord(e.read(1)))
  14.             i += 1
  15.             if i % 8 == 0:
  16.                 i = 0
  17.                 j = (j + 1) % 8
  18. print output