4.4   Going Farther: Cryptography Basics

In this section, we lay the foundation for implementing a number of different types of secret codes. (One such code is described in this chapter. Others will appear in later parts of the course.) In all cases, the basic situation is the same. There are two people named Alice and Bill who want to send messages to each other. Other people may intercept these messages, so Alice and Bill want to disguise the messages so that only they can read them. A method for disguising messages is called a cryptosystem. Many different cryptosystems have been used, but in this course we will concentrate only on those systems that have some connection with number theory.

To get started, we need a standard procedure for translating numbers into letters and vice versa. A standard conversion between letters and numbers is the American Standard Code for Information Interchange, also known as ASCII. Mathematica provides functions to convert back and forth between letters and their ASCII equivalents. ASCII reserves some numbers, such as the numbers between 0 and 31, for "nonprinting characters" such as Control characters, and we want to skip those.

The applet below will automatically perform conversions from text to numbers and from numbers to text. (It also has other functions that we will use in the next section.) To convert a text string to the numerical equivalents, just click on "Text->Nums":

Your browser does not support java.

As you can see, we are using the convention that

A = 33, B = 34, C = 35, . . . , Z = 58, a = 65, b = 66, . . . , z = 90.

A space is represented by the number 0, and our comma translated into the number 12. To convert a list of numbers back into text, we just use "Nums->Text". Applied to our output from up above:

Your browser does not support java.

Now, let's put them together on some more meaningful text. We first convert from text to numbers:

Your browser does not support java.

Now, we convert the numbers back to text:

Your browser does not support java.

Exercise 5

What is the numerical equivalent of the punctuation mark "." (period)?

Section 4.1 | Section 4.2 | Section 4.3 | Section 4.4 | Section 4.5

Chapter 4 | DNT Table of Contents

Copyright © 2001 by W. H. Freeman and Company