CEMC Banner

Problem of the Week
Problem A and Solution
Secret Message

Problem

Alicia and Bao want to send messages to each other without other people being able to read them. They set up a code that uses just 0s and 1s in the message. To decode the message it takes two steps:

  1. Read the message, 4 digits at a time. Then look up each 4-digit code in the tables below and replace it with the given lowercase letter.

    Code 0000 0001 0010 0011 0100 0101 0110 0111
    Letter a b c d e f g h

    Code 1000 1001 1010 1011 1100 1101 1110 1111
    Letter i j k l m n o p

  2. Read the new message, two consecutive letters at a time. Then look up each pair of lowercase letters in the tables below and replace them with the given uppercase letter. The word formed by these uppercase letters is the secret message.

Lowercase Letters eb ec ed ee ef eg eh ei ij ek el em en
Uppercase Letter A B C D E F G H I J K L M

Lowercase Letters eo ep fa fb fc fd fe ff fg fh fi fj fk
Uppercase Letter N O P Q R S T U V W X Y Z

For example, if Alicia sent the code 0100111101001011, after the first step the message becomes epel, and after the second step Bao knows the message is OK.

Decode the following message:

01010010010001010101001101010000010001010100001101010100

Try writing and sending secret messages of your own.

Solution

The first step in decoding the message is to convert each group of 4 digits into a single lowercase letter. This is shown in the following tables.

Code 0101 0010 0100 0101 0101 0011 0101 0000 0100 0101
Letter f c e f f d f a e f

Code 0100 0011 0101 0100
Letter e d f e

Next we take each pair of lowercase letters and decode them into a single uppercase letter, as shown below.

Lowercase Letters fc ef fd fa ef ed fe
Uppercase Letter R E S P E C T

So the secret message is RESPECT.

Teacher’s Note

This process of decoding a sequence of 0s and 1s is actually very close to the way computers store and interpret simple text. Each character on an English language keyboard has a numerical value associated with it known as its ASCII code. That ASCII code is represented by an 8-bit code, where a bit is either a 0 or 1. Inside a computer, simple text data is stored as a sequence of 0s and 1s.

Another way an ASCII code is represented is by its 2-digit hexadecimal code. Each group of four bits is equivalent to a single digit in the hexadecimal number system. There are 16 digits in the hexadecimal number system (note that there are 10 digits in our decimal number system). The only difference between how ASCII codes work and this problem is that the hexadecimal digit values are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f. This problem uses lowercase letters to represent the hexadecimal digits to avoid confusion with the bits of the secret code and actual hexadecimal digits.