Crypto - Big Stuff
Studies show that 80% of adults face anxiety on seeing big and complicated matrices. So I have used big and complicated matrices to encrypt my flag! - DarthVishnu
Last updated
Studies show that 80% of adults face anxiety on seeing big and complicated matrices. So I have used big and complicated matrices to encrypt my flag! - DarthVishnu
Last updated
We are given a file which contains a ciphertext matrix C and two lists A1 and A2 which consists of 128 10x10 matrices
The lists are generated using generate_matrices_with_det_below()
, which returns 128 10x10 matrices which have elements in the range {0,2}.
In the encrypt_message()
, an 10x10 identity matrix is initialized, which is then multiplied the matrices in the lists, depending on the index and the value of the bit of the flag, which then produces a ciphertext matrix.
We can use the fact that the starting matrix is not a matrix with large coefficients (identity matrix) and the prime used is very large to retrieve the flag.
Now how do we decide which matrix from A1 or A2 to choose from? Given the modulus is large, the entries of the inverse matrix would also be very large, even larger than the ciphertext matrix. We can use this to figure out which matrix from A1[index] or A2[index] to choose from. Suppose the matrix that was multiplied last was A1[index] and we assumed it to be A2[index]. Then the values of C*A2[index]^-1 would be much larger then the current ciphertext matrix, which means that we considered the wrong list. Using this, we can find the index corresponding to the right list and find the flag
To get the flag, we need to backtrack from a large ciphertext matrix back to an identity matrix. First, we need to check whether the values of the entries while generating the ciphertext matrix exceed the modulus or not at any point. To do this, we need to assume the largest values for all the matrices. The max value during the first round is , during the second round is ... during the last(128th) round it will be ~ which is less than the modulus.