Created
October 28, 2018 05:18
-
-
Save lingmujianshi/c8a5d8d83a3c436a85252ea2c5c2a2e0 to your computer and use it in GitHub Desktop.
encrypt for HS105
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment