Score:0

How could I find the correct key pair given the plaintext and ciphertext

jp flag

If I have a known plaintext and ciphertext pairs and 2 unknown keys of length 24 bits. (Assume encryption method is unknown)

9acb0442f0c5341e 035a85c5772da926
aa209b8e700e0976 f1849958b47fec38
6cb50b02afd3a30c 4e48ca11ee429960
10cd96722811a558 0a18dd10a6b31c5c
18d2fe904d088f48 f84950f2d18dc4e8
83e4f98dd04ab55f 4dc9a896a1dd3a99
36d9ff456172bfe3 ea626b82da337f24
516c42b078092a35 05d5757be9fca1e7

The first key encrypts the first column and the second key encrypts the result to achieve the second column. How can I find the correct key pair?

Bruteforcing 2^48 should be infeasible, so my original for loop won't work

 for (int i = 0; i < 16777216; i++) // 16777216 is 2^24 and i is for first key
            {
                for(int j = 0; j < 16777216; j++) // j is for second key
                {
                   temp = doubleEncrypt(int i, int j, a.getPlaintext()); // store the resulting cipher text in temp
                   if(temp == a.getCiphertext() // check if what we got matches the actual cipher text
                   {
                       System.out.println("The " + val+1 + "th key pair is:");
                       printKeyPair(i, j); // if match is found print keys i, j
                   }
                }
            }

My idea was to double encrypt the first column until I get the second column, but I am not sure how to do this in at most 2^25 iterations.

fgrieu avatar
ng flag
We don't answer basic homework questions. Hint: encrypt a plaintext, e.g. `9acb0442f0c5341e` with all possible keys `i` and store the results in a dictionary. Now, how would you check (with high confidence) a guess of key `j` with a single encryption or decryption operation?
Volapiik Vyrient avatar
jp flag
thank you I will try that
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.