Advertisement
Peaser

not proud

Aug 10th, 2015
656
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. from random import randrange as ran
  2.  
  3. rip   = lambda l: [i for i in l]
  4. enum  = enumerate
  5. smash = lambda l: ''.join(l)
  6. bi    = lambda s: smash([i.replace("b", "") for i in map(bin,bytearray(s))])
  7. unbin = lambda s: smash(chr(int(s[i:i+8], 2)) for i in range(0, len(s), 8))
  8.  
  9. def convertTo(s):
  10.     s = s.replace(" ", "_")
  11.     bz = bi(s); bz = rip(bz)
  12.     for k, v in enum(bz): bz[k] = {"0":chr(ran(128)), "1":chr(ran(128, 256))}[v]
  13.     return smash(bz)
  14.  
  15. def convertFrom(s):
  16.     init = smash([{ord(i) in range(128):"0", ord(i) in range(128, 256):"1"}[True] for i in s])
  17.     return unbin(init)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement