How to ask someone on a date and keep it a secret.

This post is about a project that I set 3 students in my year 10 Digital Tech class, Big Ideas in Computer Technology. Before you proceed, can you see the love message hiding in this image?

courtesy of Groklearning.com

The idea

The idea was not my own. The first time that I saw it written up properly as a project was at the University of Melbourne. I was there for a professional development day and a computer scientist, Bernie Pope, showed us a project he gave to his first years. Without describing the project in detail, here's the cut down version I used with the year 10s.

Three year 10 students collaborated on this. As an introduction to the project, I taught them how to use the python programming language to manipulate greyscale images. A greyscale photo is represented inside computer memory as a grid of pixel values. Each value is between zero and 255, indicating the pixel's brightness. Zero is the darkest shade that can appear on the screen while 255 is the brightest. The exercises they completed were inspired by the image manipulation module on groklearning.com's website.
The project asked the students to use these values to hide a message from Bob to Alice.

A little more detail 

We stuck with only lowercase letters and the space character. Each letter typed by Bob would be represented as an eight bit (binary) number using the ASCII standard. For instance the letter a is represented as 01100001 the space character is represented as 00100000. To hide the letter a inside the pixel values we want to make sure that the first 8 such values ended with 0, 1, 1, 0, 0, 0, 0, 1, respectively. The other 7 bits of each number were not used. When any of these pixels did not end with the desired bit, we modified it. 
Here is Lara (not her real name) explaining how the system works.

As mentioned by Lara, the manipulation of the least significant digit of the brightness values did not change the image in a way that could be detected by the naked eye. Modifying more bits may have distorted the image and Bob's ruse would have been uncovered.

The 3 parts of the project

Lara was responsible for writing Bob's side of the program. Another student wrote Alice’s side, the decoding part, while a third student handled the translation from alphabet to binary and back the in the other direction. That same student also handled the integration of the three parts together. It was during this phase that students learnt about the necessity to make their code modular (self-contained, able to be used my other programs as a blackbox).

Key learnings

The students had to learn a little bit about binary numbers, but only enough to realise that all even numbers had binary representations that ended with a zero while odd numbers had binary representations that ended with a one.
On the decoding end, the students needed to know how to break up a long string of zeros and ones into groups of eight bits. They ended up using modular arithmetic, which was a new mathematical concept for them. If you're unfamiliar with the term modular arithmetic, think about a 12 hour clock. After 1 hour, 13 hours or 25 hours, the clock hands will be showing the same time. This is because (current time) + 1 modulo 12 = (current time) + 13 modulo 12 = (current time) + 25 modulo 12.
From the point of view of computer programming, they learnt how to control the brightness of each pixel of an image, how to use nested loops and two dimensional arrays.

Conclusion


I felt that this project was a good combination of algorithmic thinking, mathematics, and programming. The fact that it had a visual component was a nice bonus for the three girls involved.

Comments

Popular posts from this blog

Baalbek (City of the Sun)

Book Review: The Math(s) Fix - Part 1 of 2