# How to decrypt a code with a given OTP key practically [closed]

For practicing purposes I obtained some cipher and an OTP key. Now my task is to decrypt the cipher using this key.

Both files are .bin files and when I open them with TextEdit there are a huge amount of "strange" symbols (which is obv., since its a cipher text).

But my questions is: How can I get the plaintext using the key?

• Write a program, that reads in both files and XORs the bytes at the same positions? – SEJPM May 4 '17 at 17:04
• You understand what a OTP is and how they work? It should then follow how to decrypt. – Paul Uszak May 4 '17 at 20:27
• Although we usually call it cipher-text, it's actually binary. There are many mistakes by programmers on stackoverflow that treat the ciphertext (or the key for that matter) as text. This may in the worst case lead to missing data (and usually, therefore, the ability to decrypt). – Maarten Bodewes May 4 '17 at 20:28
• @MaartenBodewes that really depends on how the programmer implements it, the last one time pad program I wrote was for text only and so I just used int, char, and modulo 26 like right off the wikipedia example. – daniel May 5 '17 at 7:01
• Hmm, yeah, should have said it is usually binary, especially if XOR is used - an operation on binary input. For modern ciphers it is certainly binary most of the time. – Maarten Bodewes May 5 '17 at 7:46

• In linux use: \$ xxd -b <filename> – puzzlepalace May 4 '17 at 21:50