public
Last active

yeEncoding

  • Download Gist
yetool.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
#!/usr/bin/env python2
import sys, math
#yeEncoding
 
if len(sys.argv) < 4:
print("Usage: yetool.py d/e <input file> <output file>")
print(" d Decode Message")
print(" e Encode Message")
print("YeTool 0.1, licensed under WTFPL")
else:
if sys.argv[1] != 'd' and sys.argv[1] != 'e': exit()
inf = open(sys.argv[2], 'r')
ind = inf.read()
inf.close()
outf = open(sys.argv[3], 'wb')
if sys.argv[1] == 'e':
for ch in ind:
v = ord(ch)
outf.write("y")
x10 = int(math.floor(v/10))
x = v - x10 * 10
outf.write("e" * x10)
outf.write("y")
outf.write("e" * x)
outf.write(" ")
outf.flush()
outf.close()
exit()
elif sys.argv[1] == 'd':
i = ind.split(" ")
for e in i:
if e == "": continue
n = e.split("y")
outf.write(chr(len(n[1]) * 10 + len(n[2])))
outf.flush()
outf.close()

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.