1+0 0+0 0+1 1+1 (1+1)%2 1^1 1^0 0^1 0^0 c=7 k=10 c^k fh_k=open('key','rb') fullkey=fh_k.read() len(fullkey) fh_cl=open('test.pdf','rb') cleartext=fh_cl.read() len(cleartext) ciphertext=[] for i range(len(cleartext)): for i in range(len(cleartext)): ciphertext.append(fullkey[i] ^ cleartext[i]) ciphertext fh_ci=open('test.pdf.enc','wb') fh_ci.write(bytes(ciphertext)) fh_ci.close() fullkey[0] cleartext[0] fullkey[0]^cleartext[0] 142^fullkey[0] quit()