Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randrange as ran
- rip = lambda l: [i for i in l]
- enum = enumerate
- smash = lambda l: ''.join(l)
- bi = lambda s: smash([i.replace("b", "") for i in map(bin,bytearray(s))])
- unbin = lambda s: smash(chr(int(s[i:i+8], 2)) for i in range(0, len(s), 8))
- def convertTo(s):
- s = s.replace(" ", "_")
- bz = bi(s); bz = rip(bz)
- for k, v in enum(bz): bz[k] = {"0":chr(ran(128)), "1":chr(ran(128, 256))}[v]
- return smash(bz)
- def convertFrom(s):
- init = smash([{ord(i) in range(128):"0", ord(i) in range(128, 256):"1"}[True] for i in s])
- return unbin(init)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement