Collaboration 5

In reality, the ADFGX cipher we discussed in class is a little more complex. Instead of printing out each two letter combination that substitutes for a single letter, there is an additional step. The letters are written out in rows under a word called a transposition key. That key is then rearranged in alphabetical order to change the order of the columns. Then, the letters are read off in columns and transmitted. Wikipedia has a nice example of how this works.

Write a script that will encrypt and decrypt a message using this more general method. Use the word "HEART" as your transposition key. You can assume the length of the input will be a multiple of 5. This code should build on your hw4 exercise, and thus it should use the same encryption table.