Cryptography & Security

Computing and Data Science
Cryptography is the study of secret communication.
Applications of cryptographic systems include:
  • Confidentiality — Only intended recipients can access private information
  • Data Integrity — Transmitted information has not been altered or synthesized
  • Authentication — Confirmed origin and destination of information as well as identity of a user
(IBM)
A cipher is an algorithm (or set of algorithms) for translating between plain text and cipher text. Ideally, cipher text is meaningless to all but the intended recipient.

Meet me at the library at noon.

→  
Encrypt
  →
0lltC0lCht
CtolCspi5h
5yChtC1221
Meet me at the library at noon.

→  
Encrypt
  →
0lltC0lCht
CtolCspi5h
5yChtC1221
0lltC0lCht
CtolCspi5h
5yChtC1221

→  
Decrypt
  →
Meet me at the library at noon.
Meet me at the library at noon.

→  
Encrypt
  →
0lltC0lCht
CtolCspi5h
5yChtC1221


0lltC0lCht
CtolCspi5h
5yChtC1221
0lltC0lCht
CtolCspi5h
5yChtC1221

→  
Decrypt
  →
Meet me at the library at noon.

Cryptographic systems by Level of Difficulty (to crack)

Rotation Cipher


Plain Text
Cipher Text

Rotation Cipher


hello world!
KHOOR ZRUOG!

Rotation Cipher



  1. How many possible encryptions?
  2. How do you decrypt a message?
  3. What are the weaknesses?

Rotation Cipher


A VGF'L LZAFC QGM USF TJWSC EQ WFUJQHLAGF. LGG ESFQ HWGHDW ZSNW LJAWV SFV XSADWV. S DGL ZSNW LJAWV SFV XSADWV.

Substitution Cipher


Substitution Cipher



  1. How many possible encryptions?
  2. How do you decrypt a message?
  3. What are the weaknesses?

Substitution Cipher


NK N ZQH AHZMVA Q FAZTAC GAFFQUA, CBAH RMO ZQH VAZMVA GR FAZTAC GAFFQUA. BMIAXAT, N INSS CTR CM GQYA NC ZBQSSAHUNHU KMT RMO!

Vigenère cipher

Vigenère cipher

Key: BELMONT
m
e
s
s
a
g
e

Vigenère cipher

Key: BELMONT
mN
e
s
s
a
g
e

Vigenère cipher

Key: BELMONT
mN
eI
s
s
a
g
e

Vigenère cipher

Key: BELMONT
mN
eI
sD
s
a
g
e

Vigenère cipher

Key: BELMONT
mN
eI
sD
sE
a
g
e

Vigenère cipher

Key: BELMONT
mN
eI
sD
sE
aO
g
e

Vigenère cipher

Key: BELMONT
mN
eI
sD
sE
aO
gT
e

Vigenère cipher

Key: BELMONT
mN
eI
sD
sE
aO
gT
eX

Vigenère cipher

  1. How many possible encryptions?
  2. How do you decrypt a message?
  3. What are the weaknesses?

Enigma Machine

Vigenère is a polyalphabetic cipher. Think of Enigma as a compound polyalphabetic cipher where each character gets multiple substitutions from multiple alphabets which change with every keystroke.
Modern cryptographic systems are math-based, and primarily built around computational complexity.

One strategy is to leverage one-way functions, operations which are computationally easy in one direction, and exceedingly difficult to reverse.
The classic example of a one-way function is multiplication.

It took me 0.00034 seconds to multiply two (prime) numbers together to get:
25400496152197968726069309778268949288246846207825351781412320795364369009011394253863307907325504274886438651152265338552397690369938370774031355003154660318291
What are the two numbers?

Public-Key Cryptography

  1. Alice creates two keys: a PUBLIC for encrypting messages, and a PRIVATE for decrypting.
  2. Alice shares her PUBLIC key.
  3. Bob encrypts a message using Alice's PUBLIC key and sends the encrypted message.
  4. Alice decrypts the message using her PRIVATE key.

Public-Key Cryptography

Alice makes 2 keys: a PUBLIC and a PRIVATE
The PUBLIC key is for ENCRYPTING
The PRIVATE key is for DECRYPTING

Public-Key Cryptography



Everyone has access to Alice's PUBLIC key

Public-Key Cryptography

QIJWLJSDF
DRPJOSHE
IXHWULSG


When Bob encrypts a message using Alice's PUBLIC key,
only Alice has the key that can decrypt it!

RSA

  1. Choose two large prime numbers \(p\) and \(q\)
  2. Compute \(n = pq\)
  3. Compute \(\lambda = \text{lcm}(p-1, q-1) \)
  4. Choose \(e\) such that \(1 \lt e \lt \lambda \) and \( \gcd(e, \lambda)=1 \)
  5. Compute \(d\) where \(de \equiv 1 \mod \lambda \)


Then \( c \equiv m^{e} \mod n \), and \(c^{d} \equiv m \mod n\)
Crypto wars

Diffie-Hellman Key Exchange

AES

Elliptic Curve Crypto

Recommended reading: "Crypto" by Steven Levy
https://en.wikipedia.org/wiki/Venona_project

©2025 Jedediyah Williams
This work is licensed under the Creative Commons
Attribution-NonCommercial-ShareAlike 4.0 International License.

To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/.