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.