Reversing AES' Key Schedule

Now that we have obtained the last round key of our 3-round AES instance, we need to finish the job and reverse the key schedule to obtain the main key.

Fortunately for us, reversing the KeyExpansion() function of AES is trivial as it was not designed to be a one-way function.

Create an InvertKeyExpansion() function that takes an index (the index of the round key) and the round key, and returns the original AES key.

Use the KeyExpansion section to figure out how to do that.

Once you're done, you can test your function on the previous attack to verify that you indeed broke your 3-round AES instance.

This is kind of the end of this short set, the next section will only be explanatory and won't expect you to code anything. You should cover them as they are pretty straight forward to understand if you've been this far.

Next