#!/usr/local/bin/python """Encode: otp.py message pad > ciphertext Decode: otp.py ciphertext pad > deciphertext and deciphertext == message. XORs message and pad.. For ^ (XOR), see Python Ref Manual (Binary Wiwise Operations): http://www.python.org/doc/current/ref/bitwise.html""" from sys import* t=p=1 s,i,j=stdout,open(argv[1], 'r'),open(argv[2], 'r') while(t and p): t,p=i.read(1),j.read(1) t and p and s.write(chr(ord(t)^ord(p)))