program one_pad; uses dos; var infile, keyfile, outfile: file of byte; plain, key, cipher: byte; begin if paramcount < 3 then begin writeln('Usage: one_pad infile keyfile outfile') end else begin assign(infile, paramstr(1)); reset(infile); assign(keyfile, paramstr(2)); reset(keyfile); assign(outfile, paramstr(3)); rewrite(outfile); while (not eof(infile)) and (not eof(keyfile)) do begin read(infile, plain); read(keyfile, key); {The following single line does the encryption/decryption.} cipher := plain xor key; write(outfile, cipher); end; close(outfile); close(infile); close(keyfile); end end.