Skip to content

Instantly share code, notes, and snippets.

@mwollenweber
Last active December 17, 2015 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwollenweber/5687219 to your computer and use it in GitHub Desktop.
Save mwollenweber/5687219 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
#base94 decode
tati_string = "replace me"
def decode(input):
output = 0
base = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}'
power = 0
for c in input:
output += base.index(c) * len(base)**power
power += 1
return output
def encode(input):
output = ''
base = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}'
while input > 0:
r = len(input) % len(base)
output += base[r]
input = int((input-r) / len(base))
return output
print decode(tati_string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment