HOME
OVERVIEW
STEGANOGRAPHY
MATRICES
CRYPTOSYSTEMS
RESOURCES
CALCULATORS

Glory to God in the highest; and on earth, peace to people on whom His favor rests! - Luke 2:14

The Joy of a Teacher is the Success of his Students. - Samuel Chukwuemeka

# CRYPTOLOGY

Gloria in excelsis Deo
Dominius vobiscum
Pax vobis

## OBJECTIVES

Students will:

(1.) Discuss cryptology.

(2.) Encode secret messages with Bacon's cipher.

(3.) Decode secret messages encoded with Bacon's cipher.

(4.) Encode secret messages with $2 * 2$ matrices.

(5.) Decode secret messages encoded with $2 * 2$ matrices.

(6.) Encode secret messages with $3 * 3$ matrices.

(7.) Decode secret messages encoded with $3 * 3$ matrices.

(8.) Encode secret messages with Ceasar's/Shift cipher.

(9.) Decode secret messages encoded with Ceasar's/Shift cipher.

(10.) Encode secret messages with Affine cipher.

(11.) Decode secret messages encoded with Affine cipher.

(12.) Encode secret messages with Block ciphers.

(13.) Decode secret messages encoded with Block ciphers.

(14.) Encode secret messages with the RSA cipher.

(15.) Decode secret messages encoded with the RSA cipher.

#### Pre-requisite Topics

(2.) Matrix Algebra

#### Skills Measured/Acquired

(1.) Use of prior knowledge

(2.) Critical Thinking

(3.) Interdisciplinary connections/applications

(4.) Technology

(5.) Active participation through direct questioning

(6.) Research

## VOCABULARY WORDS

Bring it to English Language: make, break, write, crack, secret, message, plain, text, word, sentence, information, character, steganography, public, private

Bring it to Computer Science: code, encode, decode, encipher, decipher, encrypt, decrypt, cyber operations, cyber security, information assurance, information systems, cipher, key, public key, private key, cryptosystems, cryptology, cryptography, cryptanalysis, bit, binary, digital, algorithms,

Bring it to Mathematics: modulo, modular arithmetic, primes, prime numbers, prime factors, prime factorization, least common multiple (LCM), greatest common factor (GCF), greatest common divisor (GCD), greatest common measure (GCM), totient, totatives, phi,

## DEFINITIONS

Cryptology is the science or the study of secret messages.
It is the process of:
encoding and decoding OR
encrypting and decrypting OR
enciphering and deciphering OR
writing and cracking OR
making and breaking secret messages/codes/texts.

Cryptology consists of:
Cryptography: This is the process of enciphering/encoding secret messages.
Cryptanalysis: This is the process of deciphering/decoding secret messages.

Steganography is the process of hiding a secret message inside a plain/general message.

## STUDENT PROJECTS

#### Student Projects

(1.) Use of prior knowledge

(2.) Critical Thinking

(3.) Interdisciplinary connections/applications

(4.) Technology

### General Project Requirements

(1.) This is an individual project. It is not a group project.
Students may work together. However, each student must submit his/her own project.

(2.) Each student will encode a message.

(3.) Another student (a different student) will decode the message.

(4.) If a student does not encode a message properly, another student may point out the error(s).
Pointing out the error and correcting that error may count as a decoded message.

(5.) All work/steps should be shown in decoding the message. Points will be deducted for any missing steps. Please review the examples I did. Did I miss any step? You should not miss any step.

(6.) All messages must be good messages, and be at least two words. No colloquial expressions; bad words; profane words; insensitive words related to race, sex, tribe, religion, national origin and gender among others would be accepted. If any such words appear, the student who encoded that message will not gain any point. The student who decoded the message will not be penalized.

(7.) All work must be turned in by the due date to receive credit.
Late work will not be accepted.

## BACON'S CIPHER

Developed by Francis Bacon
Also known as Bacon's cipher or Baconian cipher
Uses steganography - hiding a secret message inside a plain message. Periods and Question marks are not really relevant - they do not have any values.

Given: a plain message that has a secret message in it
To Decode: the secret message

Plain/General Message: mAY WE plEase love one AnotHer?

Some students may ask why there are combinations of lower and upper case letters. ☺
Remind them of the topic...
That is a good question though...
Let us use lower and upper case letters here.
Francis Bacon used different fonts.
Consider the objective of this topic... you want to write something that will be difficult to decode.
Which one is more challenging - using lower and upper case letters or using different fonts?

Also, Francis Bacon used $a$ and $b$
But, we shall use the binary system: $0$ and $1$
Baconian cipher uses 5 binary digits at a time for each alphabet.

Student: Excuse me Teacher. Why should we use a 5-digit binary?
Teacher: Very good question. What do you think?
Student: I do not know. That was why I asked.
Teacher: What is the last letter of the English alphabet?
What is the decimal equivalent of that last letter (in normal English Language)?
What is the decimal equivalent of that letter in Baconian Cipher?
What is the binary representation?
How many digits does that binary representation have?

So, in order to accommodate the binary representation of that last letter, we have to use 5-digit binary system.
Does it make sense?

So, let us split that message into five letters at a time
This would be:
mAYWE plEas elove oneAn otHer

Step 1:
Let us draw the Table of the Cipher Key to help us with this process.

 Alphabet Decimal $5-digit$ Binary What we shall use $a$ and $b$ What Bacon used $A$ $0$ $00000$ $aaaaa$ $B$ $1$ $00001$ $aaaab$ $C$ $2$ $00010$ $aaaba$ $D$ $3$ $00011$ $aaabb$ $E$ $4$ $00100$ $aabaa$ $F$ $5$ $00101$ $aabab$ $G$ $6$ $00110$ $aabba$ $H$ $7$ $00111$ $aabbb$ $I$ $8$ $01000$ $abaaa$ $J$ $9$ $01001$ $abaab$ $K$ $10$ $01010$ $ababa$ $L$ $11$ $01011$ $ababb$ $M$ $12$ $01100$ $abbaa$ $N$ $13$ $01101$ $abbab$ $O$ $14$ $01110$ $abbba$ $P$ $15$ $01111$ $abbbb$ $Q$ $16$ $10000$ $baaaa$ $R$ $17$ $10001$ $baaab$ $S$ $18$ $10010$ $baaba$ $T$ $19$ $10011$ $baabb$ $U$ $20$ $10100$ $babaa$ $V$ $21$ $10101$ $babab$ $W$ $22$ $10110$ $babba$ $X$ $23$ $10111$ $babbb$ $Y$ $24$ $11000$ $bbaaa$ $Z$ $25$ $11001$ $bbaab$

Step 2:
Represent lower case letters with $0$'s and uppercase letters with $1$'s
$$m\ \ A\ \ Y\ \ W\ \ E\ \ \ \ \ \ \ p\ \ l\ \ E\ \ a\ \ s\ \ \ \ \ \ \ e\ \ l\ \ o\ \ v\ \ e\ \ \ \ \ \ \ o\ \ n\ \ e\ \ A\ \ n\ \ \ \ \ \ \ o\ \ t\ \ H\ \ e\ \ r\ \\ ~~0\ \ \ 1\ \ \ 1\ \ \ 1\ \ \ 1\ \ \ \ \ \ \ 0\ \ 0\ \ 1\ \ 0\ \ 0\ \ \ \ \ \ \ 0\ \ 0\ \ 0\ \ 0\ \ 0\ \ \ \ \ \ \ 0\ \ 0\ \ 0\ \ 1\ \ 0\ \ \ \ \ \ \ ~~0\ \ 0\ \ 1\ \ 0\ \ 0\$$

Step 3:
Write the $Alphabets$ for each $5-digit\: Binary$
$$m\ \ A\ \ Y\ \ W\ \ E\ \ \ \ \ \ \ p\ \ l\ \ E\ \ a\ \ s\ \ \ \ \ \ \ e\ \ l\ \ o\ \ v\ \ e\ \ \ \ \ \ \ o\ \ n\ \ e\ \ A\ \ n\ \ \ \ \ \ \ o\ \ t\ \ H\ \ e\ \ r\ \\ ~~0\ \ \ 1\ \ \ 1\ \ \ 1\ \ \ 1\ \ \ \ \ \ \ 0\ \ 0\ \ 1\ \ 0\ \ 0\ \ \ \ \ \ \ 0\ \ 0\ \ 0\ \ 0\ \ 0\ \ \ \ \ \ \ 0\ \ 0\ \ 0\ \ 1\ \ 0\ \ \ \ \ \ \ ~~0\ \ 0\ \ 1\ \ 0\ \ 0\ \\ P\ \ \ \ \ \ \ \ ~~~~~~~~~~~~~~~~~ E\ \ \ \ \ ~~~~~~~~~~~~ \ \ \ \ A\ \ ~~~~~~~~~~~~~~ \ \ \ \ \ \ \ C\ \ \ \ \ \ \ \ ~~~~~~~~~ \ \ \ \ \ \ E$$
The secret message is PEACE

Hmmmm...do you know my nickname?

$SAMDOM\: FOR\: PEACE$

Given: a secret message, $PEACE$
To Encode: the secret message inside a plain message

Step 1:
Write the $5-digit\: binary\: representation$ of the secret message
$P = 15 = 01111$
$E = 4 = 00100$
$A = 0 = 00000$
$C = 2 = 00010$
$E = 4 = 00100$

Step 2:
Determine the character-count of the plain message.
Character count of Plain Message = Character count of Secret Message * 5
We have to multiply by $5$ because we use a 5-digit binary.
Character count of $PEACE = 5$
Character count of Plain Message = $5 * 5 = 25$
So, we need to look for a 25-character count sentence.
I looked for the greatest commandment of GOD: LOVE ONE ANOTHER
I came up with the word:
May we please love one another?
This is a $25-character$ word. Do not worry about the question mark.
You can still get any number besides $25$ but you have to complete it to be in multiples of $5$

Ask students why it is important to keep it in multiples of $5$

Step 3:
Split up the sentence in $5-character$ each
Maywe pleas elove onean other?

Step 4:
Encode each $5-character$ word according to the secret message.
Remember: the secret message is PEACE
First: Write the secret message on top of the plain text
Second: On another line; write the binary representations of the secret message on top of the plain text
Third: Encode the plain text according to the binary representations.
Write the encoded text directly below the plain text.
$0$'s indicate lower-case letters.
$1$'s indicate upper-case letters.
Please see below. $$P\ \ \ \ \ \ \ \ ~~~~~~~~~~~~~~~~~ E\ \ \ \ \ ~~~~~~~~~~~~ \ \ \ \ A\ \ ~~~~~~~~~~~~~~ \ \ \ \ \ \ \ C\ \ \ \ \ \ \ \ ~~~~~~~~~ \ \ \ \ \ \ E \\ M\ \ a\ \ y\ \ w\ \ e\ \ \ \ \ \ \ p\ \ l\ \ e\ \ a\ \ s\ \ \ \ \ \ \ e\ \ l\ \ o\ \ v\ \ e\ \ \ \ \ \ \ o\ \ n\ \ e\ \ a\ \ n\ \ \ \ \ \ \ o\ \ t\ \ h\ \ e\ \ r\ \\[5ex] 0\ \ \ 1\ \ \ 1\ \ \ 1\ \ \ 1\ \ \ \ \ 0\ \ 0\ \ 1\ \ 0\ \ 0\ \ \ \ \ \ 0\ \ 0\ \ 0\ \ 0\ \ 0\ \ \ \ \ \ 0\ \ 0\ \ 0\ \ 1\ \ 0\ \ \ \ \ \ 0\ \ 0\ \ 1\ \ 0\ \ 0\ \\ M\ \ a\ \ y\ \ w\ \ e\ \ \ \ \ \ \ p\ \ l\ \ e\ \ a\ \ s\ \ \ \ \ \ \ e\ \ l\ \ o\ \ v\ \ e\ \ \ \ \ \ \ o\ \ n\ \ e\ \ a\ \ n\ \ \ \ \ \ \ o\ \ t\ \ h\ \ e\ \ r\ \\[3ex] ~~m\ \ A\ \ Y\ \ W\ \ E\ \ \ \ \ \ p\ \ l\ \ E\ \ a\ \ s\ \ \ \ \ \ e\ \ l\ \ o\ \ v\ \ e\ \ \ \ \ \ \ o\ \ n\ \ e\ \ A\ \ n\ \ \ \ \ o\ \ t\ \ H\ \ e\ \ r\ ?$$
Then, we need to separate and join some letters to make some sense.
The encoded plain text is mAY WE plEase love one AnotHer?

May we please love one another? Pleaseeeeeeeeeeeeeeeeeeee!!!

What if we used different fonts rather than lower-case and upper-case letters?
Note the students responses again.

## RSA Cryptosystem

Developed by Ronald Rivest, Adi Shamir, and Leonard Adleman
Ask students if they noticed the bold and underlined letter in the last names - hence the name of the cryptosystem
We shall use the English letters of the Alphabet as our key.
We shall denote each letter with two digits
Ask students why we should denote each letter with two digits.
Then, explain: $A = 00$, $B = 01$, up to $Z = 25$. Do they see the reason now?
But, how do we represent a space, period, exclamation mark, etc.?
What do they think we should do?
We shall use $00$ for those. ☺
Let us define some terms before we proceed.

Totient Function
The totient function of a positive integer say $n$ is:
denoted by $\phi(n)$
also known as totatives of $n$, Euler's totient function, or Euler's phi function
defined as the number of all positive integers, $p$ such that those integers are relatively prime to $n$

In other words:
List/Count all the positive integers up to and including $n$
Find the positive integers for which the $gcd$ of $n$ and that positive integer is $1$
Count the number of those positive integers.
The count is the totient function.

Example 1:
Determine the totatives of $10$
List all the positive integers up to and including $10$
They are: $1, 2, 3, 4, 5, 6, 7, 8, 9, 10$
Which of those positive integers are relatively prime to $10$?
In other words, for which of those positive integers would the $gcd$ of $10$ and that positive integer be $1$?
They are: $1, 3, 7, 9$
How many are there?
$\therefore \phi(10) = 4$

The curious student may ask if there is another way to do this.
If nobody asked, then ask the students to find the totient function of $700$
They might scream. Yes, they have to!
Ask them to see if there is another way to find the totient function.

THANK GOD there is!

Another method to determine the totient function of a positive integer, say $n$
Step 1: Express the positive integer as a product of two prime factors, say $c$ and $d$.
This means that the two factors of that positive integer must be prime numbers.
Step 2: Use this formula: $\phi(n) = (c - 1) * (d - 1)$

Given: a message encrypted with the RSA cipher
To Decode: the encrypted message

#### References

Chukwuemeka, S.D (2016, April 30). Samuel Chukwuemeka Tutorials - Math, Science, and Technology. Retrieved from https://www.samuelchukwuemeka.com

Rosen, K. H. (2013). Discrete mathematics and its applications ($8^{th}$ ed.). New York: McGraw-Hill.

Tan, S. (2015). Finite Mathematics for the Managerial, Life, and Social Sciences (Revised/Expanded ed.). Boston: Cengage Learning.