You are on page 1of 17

Cryptology with Spreadsheets

A Computer Course for Everyone


Jim Belk
Texas A&M University
The Course
MATH 135: The Art of Secret Writing
Cornell University, Spring 2005
Humanities students fulfilling a math/computer
science requirement.
No prerequisites
Invitation to Cryptology
by Thomas H. Barr
The Book
Shift Ciphers, Affine Ciphers
Substitution Ciphers
Transposition Ciphers
Vigenre Ciphers
Hill Ciphers


Chapter 1: History and Examples
Chapter 2: Classical Ciphers
The Book
Chapter 1: History and Examples
Chapter 2: Classical Ciphers
Chapter 3: Computer Cryptology
Chapter 4: Public-Key Cryptography
(RSA, Diffie-Hellman, zero-knowledge proofs)
Chapter 5: Additional Topics
Why Spreadsheets?
Goals: Emphasize numeracy and computer
literacy.
Similar to programming, but easier to work with
and debug.
Usefulspreadsheets are the primary
mathematical software available on most PCs.
Example: Shift Cipher
Simple alphabetic shift:
y = x + c (mod 26)
MOD(A1, B1): computes the remainder when A1
is divided by B1
CODE(A1): returns the ASCII code for the
character in cell A1
CHAR(A1): returns the character whose ASCII
code is the value in cell A1
Useful Commands:
Example: Shift Cipher
MOD(A1, B1): computes the remainder when A1
is divided by B1
CODE(A1): returns the ASCII code for the
character in cell A1
CHAR(A1): returns the character whose ASCII
code is the value in cell A1
Shift by 5:
CHAR( MOD( CODE(A1) CODE(A) + 5 , 26) +
CODE(A) )
Homework 1
Problem 1:
The ciphertext:
ZSZKV DPKYL DSRKP FLJZI
was obtained using a shift cipher. Use a
spreadsheet to try all possible keys and decipher
the message.
Homework 1
Homework 1
Homework 1
Problem 2:
Similar, but the students must decode an affine
cipher, i.e.
y = ax + b (mod 26)
Later Projects
1. Decode a Substitution Cipher
Determine the letter frequencies for a 993-character
ciphertext.
Later Projects
1. Decode a Substitution Cipher
Determine the letter frequencies for a 993-character
ciphertext.
Find common digraphs and trigraphs.
Later Projects
1. Decode a Substitution Cipher
Determine the letter frequencies for a 993-character
ciphertext.
Find common digraphs and trigraphs.
Decode the message.
Later Projects
1. Decode a Substitution Cipher
2. Decode a Vigenre Cipher
Figure out how to import a 6,351-character
ciphertext into Excel.
Use the Friedman test to estimate the length of the
keyword.
Use the Kasiski test to find the keyword length.
Determine the key.
Later Projects
1. Decode a Substitution Cipher
2. Decode a Vigenre Cipher
3. Statistical analysis of the English language.
Copy 100,000 characters from the internet.
Figure out how to remove spaces and punctuation.
Count the letter frequencies and digraph
frequencies.
Later Projects
1. Decode a Substitution Cipher
2. Decode a Vigenre Cipher
3. Statistical analysis of the English language.
4. RSA-related:
Find the prime factorization of 43,428,539,417.
Compute 1281
3645
MOD 4703.
Use the Fermat primality test.
Implement the Euclidean algorithm.
Break RSA.

You might also like