Closed droberin closed 4 years ago
trying to, there is an issue with strings diff between 2.X and 3
'str' does not support the buffer interface
changing the line
sock_tcp.send(encrypt(cmd))
to
sock_tcp.send(encrypt(cmd).encode())
will fix the string bytes issue .
(I think, I am still testing)
Ok it was more than I thought. changing the following functions works in py3, (but will break py2)
def encrypt(string):
key = 171
result = b"\0\0\0"+ chr(len(string)).encode('latin-1')
for i in string.encode('latin-1'):
a = key ^ i
key = a
result += chr(a).encode('latin-1')
return result
def decrypt(string):
key = 171
result = ""
for i in string:
a = key ^ i
key = i
result += chr(a)
return result
Thanks, mate. I guess you can send a pull-request with this. Perhaps a python3 version instead of merging inside python2 version. Python2.7 is 7 years old... perhaps it's time to let it go a little.
I'll try and do a pull request with py 2/3 compatibility, whenever I get round to it.
Fixed in pull request #25
Python 3 support is added now.
Hi! I'm trying to port this into Python3. Any help?