Double Crypt 7
시간 제한1초메모리 제한1024 MB
s와 평문, 이중 AES 암호문이 주어질 때 앞 4s비트만 자유롭고 나머지는 0인 두 키를 찾아 출력한다.
문제
The Advanced Encryption Standard (AES) involves a new strong encryption algorithm. It works with three blocks of bits. Given a message block (plaintext) and a key block , the AES encryption function returns an encrypted block (ciphertext):
.
The inverse of the AES encryption function is the decryption function such that
, .
In Double AES, two independent key blocks and are used in succession, first , then :
.
In this task, an integer is also given. Only the leftmost bits of all keys are relevant, while the other bits (the rightmost minus bits) are all zero.
You are to recover the encryption key pairs for some messages encrypted by Double AES. You are given both the plaintext and the corresponding double-encrypted ciphertext , and the structure of the encryption keys as expressed by the integer .
You must submit the recovered keys, and not a recovery program.
입력
You are given ten problem instances in the text files named double1.in to double10.in. Each input file consists of three lines. The first line contains the integer , the second line the plaintext block , and the third line the ciphertext block obtained from by Double AES encryption. Both blocks are written as strings of 32 hexadecimal digits ('0'..'9', 'A'..'F'). The library provides a routine to convert strings to blocks. All input files are solvable.
출력
The first line contains the key block , and the second line the key block , such that
.
Both blocks must be written as strings of 32 hexadecimal digits ('0'..'9', 'A'..'F'). If there are multiple solutions, you need submit only one of them.
제한
For the number of relevant hexadecimal digits in a key it holds that .
힌트
A good program can recover keys in less than 10 seconds for any allowed input file.