Added python implementation

This commit is contained in:
KyleBanks 2013-10-06 16:00:17 -04:00
parent aa702ca4c7
commit 8e32db167b

31
Python/XOREncryption.py Normal file
View File

@ -0,0 +1,31 @@
#!/usr/bin/env python
# encoding: utf-8
"""
XOREncryption.py
Created by Kyle Banks on 2013-10-06.
"""
def encryptDecrypt(input):
key = ['K', 'C', 'Q'] #Can be any chars, and any size array
output = []
for i in range(len(input)):
xor_num = ord(input[i]) ^ ord('K')
output.append(chr(xor_num))
return ''.join(output)
def main():
encrypted = encryptDecrypt("kylewbanks.com");
print("Encrypted:"+encrypted);
decrypted = encryptDecrypt(encrypted);
print("Decrypted:"+decrypted);
pass
if __name__ == '__main__':
main()