Skip to content
Snippets Groups Projects
Commit 1c58af77 authored by Nathaniel Mattsson's avatar Nathaniel Mattsson
Browse files

Add encode and decode for ints

parent 8f127199
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,27 @@ def decode(msg):
def encode(str):
return ''.join(chr(alphabet.index(c) + 33) for c in str)
def decodenum(str):
num = 0
i = 1
for c in str:
num = num + (ord(c)-33)*94**(len(str)-i)
i=i+1
return num
def encodenum(num):
str = ''
i = 0
while(num//(94**i)>=1):
i=i+1
for k in range(i-1,-1,-1):
temp = num//(94**k)
num= num-temp*94**k
str=str+chr(temp+33)
return str
def run(msg):
response = requests.post('https://boundvariable.space/communicate', headers={
'Authorization': 'Bearer 8cd1314b-f873-4ab7-891f-781d814ed60e',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment