Skip to content

Instantly share code, notes, and snippets.

@fuwiak
Last active January 5, 2021 15:28
Show Gist options
  • Save fuwiak/c4612ef1e6476055bd1a24a0e95d2577 to your computer and use it in GitHub Desktop.
Save fuwiak/c4612ef1e6476055bd1a24a0e95d2577 to your computer and use it in GitHub Desktop.
def encryptDecrypt(inpString):
xorKey = 'P';
# calculate length of input string
length = len(inpString);
# perform XOR operation of key
# with every caracter in string
for i in range(length):
inpString = (inpString[:i] +
chr(ord(inpString[i]) ^ ord(xorKey)) +
inpString[i + 1:]);
print(inpString[i], end = "");
return inpString;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment