Matrix encryption

| 4 Comments

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 2x2 matrix, and put the plaintext into an nx2 matrix. Like so:

BE
AR
X
TEST_M
ESSAGE

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.

4 Comments

Peter taught me a much simpler cypher once when I was pre-teen, as I recall.

Make a pound symbol '#' large enough to write letters in. Then, A,B,C in top row of first symbol, D,E,F in middle row, etc.

In the second symbol, continue with letters, but put a dot in with the letters. In the third symbol (to capture all 26 letters, A-Z), put something else with the letters, perhaps a small circle, I forget what Peter originally suggested.

Then, with the key all made out, draw out the resulting section of the symbol... 'A' would be a baseline with a line at a right angle at the right side, a dyslecsic 'L', while 'E' would then be a simple square, and 'N' would be a drawn square with a dot in it, etc...

I hope my poor descriptive skills were adequate to what is easily shown on paper, but suffice it to say, with a key available, (or memorized, knowing Peter), then a series of lines and dots could be transcribed into a message, secret from unknowing eyes!

Cool! Sounds like it was a variant on the Pigpen Cipher, or other diagram cipher. (For people who want pictures to clarify the explanation, follow that link.)

...Coincidentally, that page includes a reference to a book by V. Hartman called The Silliest Joke Book Ever. No relation, as far as I know, but it certainly sounds like a book that a Hartman might write. :)

So BEAR is nonsingular. Good thing to know next time you are out in the woods!

Sorry, I couldn't resist - sounds like the sort of thing Peter might have said... :-)

Thanks for sharing. My memories would probably be unBEARable.

Bruce

Leave a comment