Matrix encryption
Sorry for the long silence–was busy, then had to spend a bunch of time fixing some problems with the blog. All fixed now, I think.
Welcome, Dobe! Thanks for posting!
On my way home from work this evening, I suddenly remembered something I hadn’t thought of in years: at one point when I was a kid (no idea how old), Peter taught me a nifty encryption technique based on matrix multiplication.
It turns out that this was a basic form of Hill cipher, but I didn’t know that at the time.
To use the system, we first had to create two tables for doing math on letters: a multiplication table and a division table. Each letter corresponded to a number: A was 1, B was 2, etc. I think space was zero. It’s possible that we added a couple other characters to create a prime number of characters, but for simplicity in this description, let’s say we didn’t. In that case, the multiplication and division were done modulo 27. So A x A = 1 x 1 = 1 = A; B x C = 2 x 3 = 6 = F; M x Q = 13 x 17 = 221 = 5 mod 27 = E. And so on. Division was presumably the inverse. Oh, and there must have been an addition table, too. We created tables by hand (on paper) so that we wouldn’t have to recalculate all the time; computers would’ve made this process much easier.
Then we picked a four-character encryption key (I seem to recall we used the word BEAR in one test of the system), put the letters into a 2×2 matrix, and put the plaintext into an nx2 matrix. Like so:
|
X |
|
Matrix multiplication produced the encrypted text. The recipient would find the inverse of the BEAR matrix, and multiply it by the encrypted text to produce the plaintext again.
I’m sure we only used this system half a dozen times, just for fun; it was a slow and painstaking process to encrypt and decrypt by hand. I kept the tables for years, though (they’re probably still in a box in my garage), and knowing how to do matrix multiplication came in handy years later when it came up in math class.