아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Double Crypt 7

시간 제한1초메모리 제한1024 MB

요약
s와 평문, 이중 AES 암호문이 주어질 때 앞 4s비트만 자유롭고 나머지는 0인 두 키를 찾아 출력한다.
난이도

보통10점 중 5점

유형
완전 탐색, 해시맵, 구현
정답자
아직 제출이 없습니다

문제

The Advanced Encryption Standard (AES) involves a new strong encryption algorithm. It works with three blocks of 128128 bits. Given a message block pp (plaintext) and a key block kk, the AES encryption function EE returns an encrypted block cc (ciphertext):

c=E(p,k)c = E(p, k).

The inverse of the AES encryption function EE is the decryption function DD such that

D(E(p,k),k)=pD ( E(p, k), k ) = p, E(D(c,k),k)=cE ( D(c, k), k ) = c.

In Double AES, two independent key blocks k_1k\_1 and k_2k\_2 are used in succession, first k_1k\_1, then k_2k\_2:

c_2=E(E(p,k_1),k_2)c\_2 = E ( E(p, k\_1), k\_2 ).

In this task, an integer ss is also given. Only the leftmost 4×s4 \times s bits of all keys are relevant, while the other bits (the rightmost 128128 minus 4×s4 \times s 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 pp and the corresponding double-encrypted ciphertext c_2c\_2, and the structure of the encryption keys as expressed by the integer ss.

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 ss, the second line the plaintext block pp, and the third line the ciphertext block c_2c\_2 obtained from pp 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 k_1k\_1, and the second line the key block k_2k\_2, such that 

c_2=E(E(p,k_1),k_2)c\_2 = E ( E(p, k\_1), k\_2 ).

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 ss of relevant hexadecimal digits in a key it holds that 1≤s≤51 ≤ s ≤ 5.

힌트

A good program can recover keys in less than 10 seconds for any allowed input file.

예제1

  1. 예제 1

    입력
    1
    00112233445566778899AABBCCDDEEFF
    6323B4A5BC16C479ED6D94F5B58FF0C2
    
    예상 출력
    A0000000000000000000000000000000
    70000000000000000000000000000000