SHARE
TWEET

Python - data decrypt

furas Jun 23rd, 2018 (edited) 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def decrypt(data, key):
  2.     out = []
  3.     box = list(range(256))
  4.  
  5.     x = 0
  6.     for i in range(256):
  7.         x = (x + box[i] + ord(key[i % len(key)])) % 256
  8.         box[i], box[x] = box[x], box[i]
  9.     #print('[DEBUG] x:', x) # 208
  10.  
  11.     x = 0
  12.     y = 0
  13.     for char in data:
  14.         x = (x + 1) % 256
  15.         y = (y + box[x]) % 256
  16.         box[x], box[y] = box[y], box[x]
  17.         out.append(char ^ box[(box[x] + box[y]) % 256])
  18.  
  19.     return ''.join(chr(x) for x in out)
  20.  
  21. if __name__ == '__main__':
  22.     lyric_src = 'BF24AA05A1C1BB9E3EBAC6AFCEE077A0E9AB0E8B589056BC8903932FD7D73FFFD7398A18AC67C58D5A806139A140919801119D'
  23.     data = bytes.fromhex(lyric_src)
  24.     print(decrypt(bytes.fromhex(lyric_src), 'Lyr1cjust4nct'))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top