Baltic Olympiad in Informatics: 2001 Day 1, Problem 2
Cryptography is the science and technology of coding messages so that only the intended recipient can read them. Cryptanalysis, on the other hand, is the science of breaking the codes. For this problem, assume you're a cryptanalyst hired to break open a series of encrypted messages captured in a police raid to the headquarters of the local mafia. Your colleagues have already reverse engineered the encryption program (see attachments below), and the only thing left to do is to guess the key used to encrypt the files and reverse the algorithm.
Along with the encrypted files, there are also some plaintext files that originate from the same source as the encrypted files and thus have similar structure in terms of language, word usage, etc.
The attached folder below contains the encryption programs implemented in Pascal and C (crack.pas
and crack.c
). The pseudocode of these programs is shown below.
Your task is to decrypt the given messages in the attached folder below with the help of the text of same the origin.
Constraints
All letters in the encrypted text files are upper-case.
Input Specification
You are given five data sets.
The input contains one integer , identifying the number of the current test case.
The data set for test case consists of the following files:
- , the encrypted message ( in pseudocode),
- , the plaintext file of the same origin as the encrypted message.
For example, if , the encrypted message can be found in 3.in
and the text of the same origin can be found in 3.txt
.
All data set files along with the encryption programs are found in the attachment below.
Output Specification
Decrypt the encrypted message in the file , and output the original message ( in pseudocode).
Attachment Package
The input files are available here.
Comments