CYS406 · Chapter 3

Cryptography Basics
DES & AES

Turning readable data into scrambled nonsense and back — cryptographic goals, cipher families, symmetric vs asymmetric encryption, and a deep dive into DES and the AES/Rijndael round structure.

Confidentiality · Integrity Symmetric vs Asymmetric Block vs Stream Ciphers DES AES / Rijndael Key Expansion
scroll ↓
01 / Foundations

Cryptography

Cryptography is the conversion of data into a scrambled code that is encrypted and sent across a private or public network. It protects confidential data — email, chat sessions, web transactions, personal data, corporate data, and e-commerce applications.

Objectives of Cryptography

Confidentiality
Keeps data hidden from unauthorized parties.
Authentication
Verifies the identity of the communicating parties.
Integrity
Ensures data hasn't been altered in transit.
Nonrepudiation
Prevents a sender from denying they sent a message.
Plaintext
→ Encryption →
Ciphertext
→ Decryption →
Plaintext
🧠

Mnemonic — CAIN

"CAIN guards the message"Confidentiality, Authentication, Integrity, Nonrepudiation — the four goals of cryptography. Same idea as CIA from Chapter 1, plus Authentication and Nonrepudiation baked in explicitly.

02 / Encryption Types

Symmetric vs Asymmetric Encryption

Encryption is a way of protecting information by transforming it so the result is unreadable to unauthorized parties — an encryption algorithm uses a key to perform the transformation.

🔑 Symmetric Encryption

The oldest cryptographic technique for ensuring data confidentiality. Called "symmetric" because a single key is used for both encrypting and decrypting the data. Used to encrypt large amounts of data — fast and efficient. Both sender and receiver share the same secret key.

🔐🔓 Asymmetric Encryption

Uses two separate keys: a public key (encrypts messages, can be known by anybody) and a private key (decrypts messages, known only to the recipient). Also called public-key encryption; used to encrypt small amounts of data because it's slower.

📘 Example — Asymmetric Flow

The receiver selects a public/private key pair and sends the public key to the sender. The sender uses that public key to encrypt the confidential message and sends it. The receiver decrypts the data using their own private key to read the message.

🧠

Mnemonic — One Key, Two Keys

"Symmetric = Same key (1), Asymmetric = A-pair of keys (2)" — the word "symmetric" itself means "the same on both sides," so one shared key. "Asymmetric" means "not equal," so two different, unequal keys (public ≠ private).

Government Access to Keys (GAK)

GAK means software companies give copies of all (or a sufficient proportion of) cryptographic keys to the government, which promises to hold them securely and only use them when a court issues a warrant — conceptually similar to the government's ability to wiretap phones.

03 / Ciphers

Ciphers — Types and Classification

Ciphers are algorithms used to encrypt or decrypt data. They can be classified along three different axes.

By Era

Classical Ciphers: Substitution cipher (block of plaintext replaced with ciphertext) and Transposition cipher (letters shifted about to form a cryptogram).
Modern Ciphers: what this chapter focuses on (DES, AES).

By Key Type

Private/Secret Key: same key used for encryption and decryption.
Public Key: two different keys are used for encryption and decryption.

By Input Type

Block Cipher: encrypts blocks of data of fixed size.
Stream Cipher: encrypts continuous streams of data.

Secret Key Algorithms

Block Ciphers (e.g., DES, AES)

Take a key and a fixed-size input block to generate a fixed-size output block.

Stream Ciphers (e.g., RC4)

Take a key and generate a stream of pseudorandom bits, which are XOR'd into the data.

🧠

Mnemonic — Brick vs Hose

Think of a block cipher as stacking bricks — fixed-size chunks processed one at a time (DES = 64-bit bricks, AES = 128-bit bricks). A stream cipher is a hose — a continuous flow of bits XOR'd on the fly, no fixed chunk size (RC4).

04 / DES

Data Encryption Standard (DES)

DES is designed to encipher and decipher blocks of data consisting of 64 bits under control of a 56-bit key. DES is the archetypal block cipher — an algorithm that takes a fixed-length string of plaintext bits and transforms it into a ciphertext bit string of the same length.

Block Size
64 bits of plaintext per block.
Key Size
56-bit key (the classic weak point of DES today).
3DES
Due to DES's weakness against modern computing power, some organizations triple-repeat the DES process (3DES) for added strength until they can move to AES.
⚠️

Why DES is considered weak today

Its 56-bit key is small by modern standards — brute-forceable with today's computing power. 3DES was the stopgap fix before AES became the new standard.

05 / AES History

Advanced Encryption Standard (AES)

AES is a symmetric-key algorithm used by US government agencies to secure sensitive but unclassified material. It is an iterated block cipher that works by repeating the same operation multiple times. It has a 128-bit block size, with key sizes of 128, 192, or 256 bits for AES-128, AES-192, and AES-256 respectively.

How AES Was Chosen — Timeline

1

1997 — NIST Call

US NIST issued a call for ciphers to replace DES/Triple-DES, which was slow and used small blocks.

2

Jun 1998 — 15 Candidates

15 candidate ciphers were accepted for consideration.

3

Aug 1999 — 5 Shortlisted

The field was narrowed down to 5 finalists.

4

Oct 2000 — Rijndael Selected

Rijndael, designed by Vincent Rijmen and Joan Daemen (Belgium), was selected as the AES winner.

5

Nov 2001 — FIPS PUB 197

AES was formally issued as the FIPS PUB 197 standard.

🧠

Mnemonic — "1997, Never 15-5-Rijndael-01"

"Call, Cut, Choose, Codify" → NIST Called for ciphers ('97) → Cut down to 15 ('98) → Cut further to 5 ('99) → Chose Rijndael ('00) → Codified as FIPS 197 ('01). Five C's, five years (1997–2001), five steps.

Rijndael Design Goals

Resistant against known cryptanalysis attacks

Speed and code compactness on many CPUs

Design simplicity

Rijndael is an iterative cipher (rather than a Feistel cipher like DES) — it processes data as a block of 4 columns of 4 bytes and operates on the entire data block in every round.

06 / AES Internals

AES Structure — The State & Rounds

AES is a non-Feistel cipher that encrypts and decrypts a data block of 128 bits arranged in a matrix of 4 columns of 4 bytes, called the state. It uses 10, 12, or 14 rounds, depending on key size (128/192/256 bits). The key is expanded into an array of words to supply each round.

Key Size → Rounds
Variant Key Size Rounds
AES-128 128 bits 10
AES-192 192 bits 12
AES-256 256 bits 14
DES vs AES
  • DES: 64-bit block, 56-bit key, Feistel structure
  • AES: 128-bit block, 128/192/256-bit key, non-Feistel (substitution-permutation)
  • AES is faster, more compact in code, and far more resistant to brute force

The Four Round Operations

In each round, the state undergoes four transformations in this exact order (the final round skips MixColumns):

1

SubBytes (Byte Substitution)

Substitutes each byte using a single S-box, applied to every byte independently. Interprets the byte as two hexadecimal digits to look up its substitution.

2

ShiftRows

A circular byte shift to the left in each row of the state. Decryption inverts this using shifts to the right. Since the state is processed by columns, this step permutes bytes between the columns.

3

MixColumns

Mixes bytes using matrix multiplication. Each column is processed separately; each byte is replaced by a value that depends on all 4 bytes in that column.

4

AddRoundKey

XORs the state with 128 bits of the round key. Processed by column (though effectively a series of byte operations). Since XOR is its own inverse, decryption uses the same operation with reversed keys — a form of the Vernam cipher applied to the expanded key.

🧠

Mnemonic — "Sub Shifts Mix Keys" (SSMK)

"Silly Snakes Mix Kool-Aid"SubBytes (swap bytes via S-box) → ShiftRows (slide rows sideways) → MixColumns (blend each column with matrix math) → AddRoundKey/Key (XOR in the round key). Only the last step (AddRoundKey) actually uses the key — the other three just scramble structure.

Key Expansion

Objective: create round keys for each round. If the number of rounds is Nr, the key-expansion routine creates Nr + 1 128-bit round keys from one single 128-bit cipher key. It takes the 128-bit (16-byte) key and expands it into an array of 44/52/60 32-bit words (for AES-128/192/256 respectively).

📘 How Expansion Works

Start by copying the key into the first 4 words. Then loop, creating new words that depend on the value in the previous word and the word 4 positions back. In 3 of every 4 cases, these are simply XOR'd together. In the 1st word of every group of 4, there's an extra transform: rotate the bytes, run them through the S-box, then XOR with a round constant, before XOR-ing with the word 4 back.

📘 SubBytes Worked Concept

To substitute a byte, interpret it as two hexadecimal digits — the first digit selects the row, the second selects the column in the AES S-box lookup table, and the value found there replaces the original byte.

AES Summary — Key Facts

07 / Exam Prep

Exam Tips & Tricks

💡

DES numbers to memorize

64-bit block, 56-bit key. AES numbers: 128-bit block always, with 128/192/256-bit keys and 10/12/14 rounds respectively.

Symmetric = 1 key, large data / Asymmetric = 2 keys, small data

This speed/size trade-off is a favorite exam distinction.

⚠️

AES is non-Feistel, DES is Feistel

Don't mix these up — AES processes the whole block every round (substitution-permutation network); DES splits into halves each round (Feistel network).

🔑

Round order: Sub → Shift → Mix → AddRoundKey

Only AddRoundKey uses the actual key; the final round skips MixColumns.

📋

Rijndael naming

Rijndael = the cipher's original name (Rijmen + Daemen); AES = the name once NIST standardized it as FIPS PUB 197 in 2001.

🌐

Key expansion count

Number of round keys = Nr + 1 (one extra beyond the number of rounds, because one is used before round 1 begins).

08 / Cheat Sheet

Quick Reference — Everything at a Glance

Topic Key Point
Cryptography Converts data into scrambled code sent across a network
Objectives of cryptography Confidentiality, Integrity, Authentication, Nonrepudiation
Encryption / Decryption Plaintext → Ciphertext → Plaintext, via key-driven algorithm
Symmetric encryption One shared key; fast; used for large data
Asymmetric encryption Public key (encrypt) + private key (decrypt); used for small data
GAK Government Access to Keys — govt holds key copies, uses only with a warrant
Classical ciphers Substitution (replace) and Transposition (shift order)
Modern cipher key types Private key (1 key) vs Public key (2 keys)
Block cipher Encrypts fixed-size blocks (DES, AES)
Stream cipher Encrypts continuous streams via XOR (RC4)
DES block/key size 64-bit blocks, 56-bit key
3DES DES applied 3 times for extra strength as an interim fix
AES block size Always 128 bits
AES key sizes & rounds 128-bit/10 rounds, 192-bit/12 rounds, 256-bit/14 rounds
AES history NIST call 1997 → 15 candidates 1998 → 5 finalists 1999 → Rijndael chosen 2000 → FIPS 197 in 2001
Rijndael designers Vincent Rijmen & Joan Daemen (Belgium)
AES cipher type Non-Feistel, iterative, operates on the whole "state" each round
State 128-bit block arranged as 4 columns of 4 bytes
SubBytes Byte substitution via S-box
ShiftRows Circular left shift of bytes within each row
MixColumns Matrix-multiply mixing of each column's 4 bytes
AddRoundKey XOR state with round key — only step that uses key material
Key expansion 128-bit key expanded into 44/52/60 32-bit words; produces Nr+1 round keys
Final round Only 3 stages — MixColumns is omitted
Decryption Uses round keys in reverse order; every step is reversible