Thanks to Alfred Thompson for this idea. It came through a Facebook post.
So, I took the bait. It had indeed been a long time since I thought about ROT13.
I do remember in elementary school going to school with a set of twins. At times, they had their own language. They would talk back and forth and nobody, especially the teacher, could understand what they were saying. It infuriated her that these two were talking “in code”.
We were no better with passing notes to each other. Of course, we didn’t want the note to be intercepted and, if it was, we had our own “code” to make sure that the message wasn’t read. It was only the high level type of security that someone in Grade 5 could develop. We would just shift the letter one digit to the right. So, DOUG would become EPVH. All the recipient would have to do is uncode it by selecting the letter to the left. We were so clever; that dumb teacher would never figure it out. Ah, we should have just quit while we knew everything.
It wasn’t until I studied Computer Science (and later taught it) that the beauty of encoding a message was really appreciated.
At university, we had a number of problems to code / decode strings of characters using various algorithms. It wasn’t until I actually taught Computer Science that I realized that ROT13 was “a thing”. And, it was a beautiful thing to have. The concept could be used in a number of ways.
The ROT? It is short for “rotate”. In essence, we were doing ROT1 in Grade 5 – rotating by one letter. ROT13 is a very special version of this. Since there are 26 letters in the alphabet, ROT13 meant rotating half-way through the alphabet in coding and decoding.
One of the topics to be covered was the breaking of the code used by the Germans in World War II. Of course, it involved an appreciation of Alan Turing but ROT became a hands on activity as we did our own messaging. I remember one group of students creating their own cracking device with a couple of sheets of paper.
But there’s more.
If you create an array, say LETTER, of 26 characters, then you would assign LETTER(1)=”A”, LETTER(2)=”B”, etc. to encode / decode, it was just matter of adding or subtracting 13 from the index to make it work. And, of course, there was the challenge of what to do when you add to the index and it goes above index 26 or or subtracting leaves it below index 1.
Every computer programmer knows that CHR(65) is the letter A. Actually, the whole ASCII table is just one big array, but you don’t mention that until you’re done. So, to encode the letter A with ROT13, it’s just a matter of replacing it with CHR(78). No need to work it out – it’s the letter N.
In another variation of a theme, forget all the fanciness of using an array. Just go with the string itself. DOUG The algorithm involves determining the length of the string and then going through things extracting one letter at a time, rotating it by 13, and adding the result to an output string. When you’re done, the message is encoded.
For some reason, this really caught student interest and led to some interesting conversations.
“If people know that it’s ROT13, it’s just as easily decoded” (Yep)
“What if we double ROT13ed it?” (Short discussion on the inadvisability of doing that. In retrospect, I should have let them do it as it would have led to a better discussion – how do you know if your program works when it gives unexpected answers?)
“What if we didn’t do ROT13 but something else?” (For every problem, there’s a solution)
“What if we ROT13 the first letter, ROT14 the second, and so on” (Liking this line of thinking)
“What if we ROTted with a random number?” (Slick. I knew we taught random numbers for some reason)
“What if we ROTted with a seed from the computer clock?” (I made the mistake of showing them how to read the computer clock and using some of it as random numbers. When the only tool you have is a hammer, everything looks like nails)
And some good problem solving. “We’ll send the message via email and send the decryption key in another email. ”
“What if someone gets both messages?”
“We’ll ROT the key”. (They now own a new hammer)
It led to good discussions too. We were using QNX as an operating system then and I created a few dummy accounts and showed them that the passwords were stored in straight ASCII. They were appalled!
It led to some enhancements too.
“Sir, we didn’t want to be limited to the letters A-Z so we modified it for lower case, numbers, special characters, …” (Hey, this course teaches itself)
These days, encryption is such an important topic. As Alfred notes, there was an attempt in some newsgroups to stop people from giving away spoilers by ROT13ing them. You could easily decode them if you really wanted to know the answer or just ignore it if you didn’t. ROTting is a relatively easy mental exercise. But, I’ll be honest. I can’t remember the last time I’ve seen it in use.
But the conversation about encryption continues.
With online banking and other things, secure connections are so important. Of course, the algorithms are so more sophisticated than ROT13 but you have to start somewhere.
For a Sunday, what are your thoughts?
- Did you ever pass notes in school? Did you have a way to make sure that they or their message they didn’t fall into the wrong hands?
- Do you double and triple check for a secure connection when buying things online or doing banking? Report cards?
- Do you use EFF’s https everywhere extension to ensure that your connections are encrypted?
- If you’re teaching students, what steps do you talk about to teach them about privacy online?
- Computer Science teachers – do you have any interesting lessons about ROT13 or encryption to share?
As always, I’d be most interested in your thoughts? Please share them in the comments below. Bonus – you don’t have to write your own ROT13 these days – check out this site – http://www.rot-n.com/
This is part of a regular Sunday series that can be accessed here.
Do you have an idea for a topic like Alfred did? Let me know. You can use this Padlet for the task.
Happy Mothers’ Day