Skip to content

Instantly share code, notes, and snippets.

View lingmujianshi's full-sized avatar

lmjs lingmujianshi

View GitHub Profile
@lingmujianshi
lingmujianshi / encrypt.py
Created October 28, 2018 05:18
encrypt for HS105
def encrypt(string):
key = 171
result = pack('>I', len(string))
for i in string:
a = key ^ ord(i)
key = a
result += a.to_bytes(1,'big') #python2 : result += chr(a)
return result
@lingmujianshi
lingmujianshi / decrypt.py
Last active October 28, 2018 05:17
decrypt for HS105
def decrypt(string):
key = 171
result = ""
for i in string:
a = key ^ i #python2 a = key ^ ord(i)
key = i #python2 key = ord(i)
result += chr(a)
return result