import sys if len(sys.argv) != 3: print("Usage: python3 vernam.py [key] [string]") sys.exit(1) key = sys.argv[1] string = sys.argv[2] if len(string) != len(key): print("Key and string must have the same length") sys.exit(1) encrypted = "" for i in range(len(string)): encrypted += chr(ord(string[i]) ^ ord(key[i])) # print(ord(string[i]) ^ ord(key[i])) print(encrypted) # python3 vernam.py ABCDEF TOMATE | xargs python3 vernam.py ABCDEF