Monday, February 15, 2010

Self-fullfilling Cryptography

One of the courses I'm teaching this term is cryptography, which is, roughly speaking, the study of sending secret messages. At first glance, one wouldn't expect that very much mathematics would be involved, but even the simple schemes that I found in my children's activity books when I was young can be phrased in mathematical terminology.

Conversely, at first glance, one wouldn't expect that the mathematics involved could ever be used for cryptography. The first time I learned about the relevant mathematics, I was not aware of its application to cryptography. It was merely presented to me, like most of the math I learned, as a series of interesting and confusing but mostly useless results. In fact, when I first saw this material, it seemed to be just about the most useless and abstract math I had ever learned.

The fact that it didn't appear to have any use was not a deterrent for me. I still wanted to study it. Yet I was often asking myself "So what? Who cares about greatest common divisors and all that, other than mathematicians?" So one of my motivations when I decided I wanted to teach this course was to learn about the different ways in which this seemingly useless mathematics could be used to solve so-called "real life" problems. So here I am, teaching cryptography.

Recently I handed out on assignment, which was due this past Wednesday. I took a cursory glance at one of the assignments that was handed in and noticed a strange solution to one of the questions. But as I looked more carefully, I saw that he had done everything right.

In preparing this assignment, there were some other questions for which I needed to encode substantially large pieces of text, so I wrote some short programs to assist me. After, I saw the student's strange but correctly obtained answer, I re-examined my code. It turns out I made two small errors. In one case, I misinterpreted a command, which almost did what I wanted it to, but in the reverse order that I needed it to. In the other case, I used the wrong scheme for representing text numerically. It's more natural to represent letters A,B,...,Z by the numbers 1,2,...,26, but in cryptography, we represent A,B,...,Z by the number 0,1,...,25. I used 24 to represent the letter X, according to the more natural scheme, when I should have used 23, as any good cryptographer would. The answer that the students would come to, after doing everything as I told them to, was

ihavf nui bffn sucyfxyaseull.

Kudos to you if you could have figured out what that's supposed to say. The message that they should have gotten, had I not made those errors, is
I have not been successful.

Indeed, I have not.

1 comment:

Anonymous said...

Indeed, you have not. You must have all had a good laugh about that one.
Melanie