Editorial for COCI '09 Contest 6 #3 Dosadan


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

This task was inspired by a puzzle from +Ma's Reversing site.

OTP is a theoretically perfect algorithm, if implemented correctly. In most cases, if it fails, it fails due to human error. In this task, the key bit of information is the structure of the plaintext and the key. Let us take a look at the binary coding of plaintext letters. We see that letters a - z all have the 7^\text{th} bit equal to 1. Numbers 0 - 9 present in the key all have the 7^\text{th} bit equal to 0. Space and full stop also have the 7^\text{th} bit equal to 0. This is enough information to conclude that in the ciphertext, all letters will have the 7^\text{th} bit equal to 1, and space and full stop 0. This is enough information to solve this task.

For extra points, you might have realized that this now provides enough information for you to try and decrypt the test data completely. Using some guesswork, of course.


Comments

There are no comments at the moment.