π Block Cipher Architectures, Permutation-Substitution Networks & Galois Arithmetic
Modern symmetric cryptography forms the bedrock of data confidentiality across storage volumes, transport channels, and hardware security modules. Unlike classical stream and substitution systems, modern symmetric cryptography relies on Block Ciphers, which transform fixed-length blocks of plaintext into ciphertext blocks of identical size using shared secret keys. Two primary structural paradigms govern modern block ciphers: the Feistel Network (used in the legacy Data Encryption Standard - DES and Triple-DES), which splits blocks into halves and achieves reversible decryption using non-invertible round functions; and the Substitution-Permutation Network (SPN) implemented by Vincent Rijmen and Joan Daemen in the Advanced Encryption Standard (AES). Rooted in finite field arithmetic over Galois Field $\text{GF}(2^8)$ and structured around four algebraic transformations per round, AES guarantees defense against linear and differential cryptanalysis while supporting high hardware throughput across modern CPUs via dedicated AES-NI instructions.
BLOCK CIPHER TOPOLOGY COMPARISON:
1. FEISTEL CIPHER NETWORK (e.g., DES, 3DES, Blowfish):
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Input Plaintext Block (2w bits) βββΊ Split into Left (L_0) and Right (R_0) Halves (w bits each)β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββ βββββββββββββ
β L_i β β R_i β
βββββββ¬ββββββ βββββββ¬ββββββ
β β
β ββββββββ΄βββββββ
β β Round Func βββββ Subkey K_i
β β F(R, K) β
β ββββββββ¬βββββββ
βΌ β
( + ) ββββββββββββββββββββββββββββ (Bitwise XOR)
β
β (Cross-over Swap)
ββββββββββββββββββββββββββββββββ
β βΌ
βΌ βββββββββββββ
βββββββββββββ β R_(i+1) β
β L_(i+1) β β = L_i(+)Fβ
β = R_i β βββββββββββββ
βββββββββββββ
β’ Decryption Invariant: Exactly identical circuit topology; subkeys reversed (K_16 to K_1).
β’ Advantage: Round function F does NOT need to be mathematically invertible!
2. SUBSTITUTION-PERMUTATION NETWORK - SPN (e.g., AES / Rijndael):
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β State Matrix (128 bits: 4x4 bytes) βββΊ Inverted via explicit inverse mathematical steps β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββ
β SubBytes (Non-linear S-Box) β βββΊ Confusion (GF(2^8) Inversion)
βββββββββββββββββ¬ββββββββββββββββ
βΌ
βββββββββββββββββββββββββββββββββ
β ShiftRows (Cyclic Byte Shift) β βββΊ Diffusion (Inter-column mixing)
βββββββββββββββββ¬ββββββββββββββββ
βΌ
βββββββββββββββββββββββββββββββββ
β MixColumns (Matrix Galois Mul)β βββΊ Diffusion (Linear MDS diffusion)
βββββββββββββββββ¬ββββββββββββββββ
βΌ
βββββββββββββββββββββββββββββββββ
β AddRoundKey (XOR Round Key) β βββΊ Key Injection (XOR Subkey)
βββββββββββββββββββββββββββββββββ
β’ Decryption Requirement: Every component (InvSubBytes, InvShiftRows, InvMixColumns) must be invertible.
# DES Expansion Table (E-Bit Selection Table: 32 bits expanded to 48 bits)
E_EXPANSION_TABLE = [
32, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9,
8, 9, 10, 11, 12, 13,
12, 13, 14, 15, 16, 17,
16, 17, 18, 19, 20, 21,
20, 21, 22, 23, 24, 25,
24, 25, 26, 27, 28, 29,
28, 29, 30, 31, 32, 1
]
# Standard DES Substitution Box S1 (4 rows x 16 columns)
S1_BOX = [
[14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7],
[ 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8],
[ 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0],
[15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13]
]
def permute(input_bits: str, table: list) -> str:
"""Permutes bit-string according to standard DES index tables."""
return "".join(input_bits[idx - 1] for idx in table)
def s_box_substitution(six_bit_chunk: str, s_box: list) -> str:
"""
DES Non-Linear S-Box mapping:
Row determined by outer bits (bit 0 and bit 5).
Column determined by middle 4 bits (bits 1, 2, 3, 4).
"""
row = int(six_bit_chunk[0] + six_bit_chunk[5], 2)
col = int(six_bit_chunk[1:5], 2)
val = s_box[row][col]
return f"{val:04b}"
def des_f_function(right_half_32: str, subkey_48: str) -> str:
# 1. Expansion permutation: 32 bits -> 48 bits
expanded_48 = permute(right_half_32, E_EXPANSION_TABLE)
# 2. Key mixing: XOR with round subkey
xored = f"{int(expanded_48, 2) ^ int(subkey_48, 2):048b}"
# 3. S-Box Substitution (Demonstrated on first 6-bit chunk using S1)
s1_input = xored[:6]
s1_output = s_box_substitution(s1_input, S1_BOX)
return f"S1_Out={s1_output} (from 6-bit input {s1_input})"
if __name__ == "__main__":
r_half = "11110000111100001111000011110000" # 32 bits
k_sub = "101010" * 8 # 48 bits
print(f"[*] R-Half (32 bits) : {r_half}")
print(f"[*] Subkey (48 bits) : {k_sub}")
f_result = des_f_function(r_half, k_sub)
print(f"[+] Feistel Stage 1 : {f_result}")
print("[!] Security Note : DES has a 56-bit effective key space (2^56 = 7.2x10^16 keys),")
print(" which can be brute-forced in hours with modern hardware (EFF Deep Crack).")
"""
THE MEET-IN-THE-MIDDLE ATTACK ON DOUBLE-DES (2DES):
Why 2DES (C = E_k2(E_k1(P))) provides only 2^57 security, not 2^112:
Given known plaintext-ciphertext pair (P, C):
C = E_k2(E_k1(P)) ===> D_k2(C) = E_k1(P) = M (Intermediate State)
Attack Steps:
1. Forward Phase: Encrypt P with all 2^56 possible values of k1.
Store pairs (E_k1(P), k1) in an in-memory hash table indexed by M.
Time: 2^56 operations. Memory: 2^56 entries.
2. Backward Phase: Decrypt C with all 2^56 possible values of k2.
Look up D_k2(C) in the hash table.
If a match M occurs, candidate key pair is (k1, k2).
Verify candidate on a second known (P2, C2) block.
Total Complexity: 2^56 + 2^56 = 2^57 encryptions, NOT 2^112!
TRIPLE-DES (3DES / TDEA) ARCHITECTURE:
To defend against Meet-in-the-Middle, 3DES uses 3 keys in Encrypt-Decrypt-Encrypt sequence:
C = E_k3( D_k2( E_k1(P) ) )
P = D_k1( E_k2( D_k3(C) ) )
Keying Options:
β’ 3-Key 3DES (3TDEA): k1 != k2 != k3 (Effective key length: 112 bits against MitM)
β’ 2-Key 3DES (2TDEA): k1 == k3 != k2 (Effective key length: 80 bits, deprecated by NIST SP 800-131A)
β’ Backward Compatibility: When k1 == k2 == k3, E_k1(D_k1(E_k1(P))) = E_k1(P) (Standard DES)
"""
class TripleDesSpec:
@staticmethod
def evaluate_effective_security(key_mode: str) -> dict:
if key_mode == "3KEY_3DES":
return {"key_length_bits": 168, "effective_security_bits": 112, "nist_status": "Deprecated (2023)"}
elif key_mode == "2KEY_3DES":
return {"key_length_bits": 112, "effective_security_bits": 80, "nist_status": "Disallowed"}
elif key_mode == "DOUBLE_DES":
return {"key_length_bits": 112, "effective_security_bits": 57, "nist_status": "Broken (MitM Attack)"}
else:
return {"key_length_bits": 56, "effective_security_bits": 56, "nist_status": "Broken (Exhaustive Search)"}
if __name__ == "__main__":
modes = ["DOUBLE_DES", "2KEY_3DES", "3KEY_3DES"]
print(f"{'CIPHER SCHEME':<14} | {'KEY BITS':<10} | {'SECURITY STRENGTH':<18} | {'NIST STATUS'}")
print("-" * 75)
for m in modes:
res = TripleDesSpec.evaluate_effective_security(m)
print(f"{m:<14} | {res['key_length_bits']:<10} | {res['effective_security_bits']} bits | {res['nist_status']}")
0x11B), implemented via the xtime() doubling operation.
class GaloisField256:
"""
Implements GF(2^8) arithmetic defined by AES Rijndael standard.
Irreducible polynomial: m(x) = x^8 + x^4 + x^3 + x + 1 (0x11B)
Addition in GF(2^8) is bitwise XOR (^).
Multiplication by x (0x02) is performed via xtime().
"""
IRREDUCIBLE_POLY = 0x11B
@staticmethod
def add(a: int, b: int) -> int:
"""Addition in GF(2^8) is bitwise XOR."""
return a ^ b
@classmethod
def xtime(cls, byte_val: int) -> int:
"""
Multiplication of a byte by 0x02 (x) in GF(2^8):
Left-shift by 1. If high bit was 1, XOR with 0x1B to reduce modulo m(x).
"""
shifted = (byte_val << 1) & 0xFF
if byte_val & 0x80: # If MSB was set prior to shift
shifted ^= 0x1B
return shifted
@classmethod
def multiply(cls, a: int, b: int) -> int:
"""
Russian Peasant multiplication algorithm in GF(2^8).
Decomposes b into powers of x using xtime().
"""
result = 0
temp_a = a
temp_b = b
for _ in range(8):
if temp_b & 1:
result ^= temp_a
temp_a = cls.xtime(temp_a)
temp_b >>= 1
return result
if __name__ == "__main__":
gf = GaloisField256()
# Standard MixColumns constant multiplication checks:
# 0x57 * 0x02 = 0xAE
# 0x57 * 0x04 = xtime(0xAE) = 0x47
# 0x57 * 0x13 = 0xFE
a_byte = 0x57
val_x2 = gf.xtime(a_byte)
val_x3 = gf.multiply(a_byte, 0x03) # 0x03 = (x + 1), so (a * 0x02) ^ a
print(f"[*] Base Byte a : 0x{a_byte:02X} ({a_byte:08b})")
print(f"[+] a * 0x02 (xtime) : 0x{val_x2:02X} ({val_x2:08b})")
print(f"[+] a * 0x03 (MixCol) : 0x{val_x3:02X} (Verified: 0x{val_x2 ^ a_byte:02X})")
print(f"[+] a * 0x13 in GF(2^8): 0x{gf.multiply(0x57, 0x13):02X} (Expected: 0xFE)")
assert gf.multiply(0x57, 0x13) == 0xFE, "GF(2^8) calculation failure!"
def print_state_matrix(matrix: list, label: str):
print(f"--- {label} (4x4 State) ---")
for r in range(4):
print(" " + " ".join(f"{matrix[r][c]:02X}" for c in range(4)))
def shift_rows(state: list) -> list:
"""
Cyclic left-shift of each row in the 4x4 state matrix:
Row 0: Shift by 0 bytes
Row 1: Shift by 1 byte
Row 2: Shift by 2 bytes
Row 3: Shift by 3 bytes
"""
shifted = [
state[0][:], # Row 0: No shift
state[1][1:] + state[1][:1], # Row 1: Left 1
state[2][2:] + state[2][:2], # Row 2: Left 2
state[3][3:] + state[3][:3] # Row 3: Left 3
]
return shifted
def mix_columns(state: list) -> list:
"""
Multiplies each 4-byte column by the fixed MDS matrix over GF(2^8):
[02 03 01 01]
[01 02 03 01]
[01 01 02 03]
[03 01 01 02]
"""
from __main__ import GaloisField256
gf = GaloisField256()
result = [[0] * 4 for _ in range(4)]
for c in range(4):
s0, s1, s2, s3 = state[0][c], state[1][c], state[2][c], state[3][c]
result[0][c] = gf.multiply(s0, 2) ^ gf.multiply(s1, 3) ^ s2 ^ s3
result[1][c] = s0 ^ gf.multiply(s1, 2) ^ gf.multiply(s2, 3) ^ s3
result[2][c] = s0 ^ s1 ^ gf.multiply(s2, 2) ^ gf.multiply(s3, 3)
result[3][c] = gf.multiply(s0, 3) ^ s1 ^ s2 ^ gf.multiply(s3, 2)
return result
if __name__ == "__main__":
# Sample 16-byte state matrix (column-major byte array)
test_state = [
[0x63, 0xEB, 0x9F, 0xA0],
[0xC0, 0x2B, 0x93, 0xC0],
[0xBA, 0x84, 0x11, 0xE7],
[0x71, 0x29, 0xC1, 0x36]
]
print_state_matrix(test_state, "INITIAL AES STATE")
after_shift = shift_rows(test_state)
print_state_matrix(after_shift, "AFTER ShiftRows")
after_mix = mix_columns(after_shift)
print_state_matrix(after_mix, "AFTER MixColumns")
RotWord, SubWord via the Rijndael S-Box, and the round constant (Rcon).
# AES S-Box excerpt for SubWord demonstration
S_BOX = [
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0
]
# Round Constants Rcon[i] = [RC[i], 0x00, 0x00, 0x00]
RCON = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36]
def rot_word(word: list) -> list:
"""Cyclic left-shift of a 4-byte word: [b0, b1, b2, b3] -> [b1, b2, b3, b0]."""
return word[1:] + word[:1]
def sub_word(word: list) -> list:
"""Applies S-Box substitution to each byte of a 4-byte word."""
return [S_BOX[b % len(S_BOX)] for b in word]
def aes_128_key_expansion_step(words: list, round_idx: int) -> list:
"""
Generates word w[i] from preceding words:
If i is multiple of 4: w[i] = w[i-4] ^ SubWord(RotWord(w[i-1])) ^ Rcon[i/4]
Else: w[i] = w[i-4] ^ w[i-1]
"""
prev = words[-1]
w_minus_4 = words[-4]
temp = rot_word(prev)
temp = sub_word(temp)
# XOR with round constant on first byte
rcon_byte = RCON[round_idx]
temp[0] ^= rcon_byte
new_word = [w_minus_4[k] ^ temp[k] for k in range(4)]
return new_word
if __name__ == "__main__":
# Base 128-bit key partitioned into four 4-byte words
w0 = [0x2B, 0x7E, 0x15, 0x16]
w1 = [0x28, 0xAE, 0xD2, 0xA6]
w2 = [0xAB, 0xF7, 0x15, 0x88]
w3 = [0x09, 0xCF, 0x4F, 0x3C]
initial_words = [w0, w1, w2, w3]
w4 = aes_128_key_expansion_step(initial_words, round_idx=0)
print("[*] Base Round Key 0 Words:")
for idx, w in enumerate(initial_words):
print(f" w[{idx}] = " + " ".join(f"{b:02X}" for b in w))
print("[+] Word w[4] (First word of Round Key 1):")
print(f" w[4] = " + " ".join(f"{b:02X}" for b in w4) + " (Derived via RotWord, SubWord, Rcon[1])")
BLOCK CIPHER MODES OF OPERATION ANALYSIS:
1. ELECTRONIC CODEBOOK (ECB):
β’ Equation: C_i = E_K(P_i)
β’ Flaw: Identical plaintext blocks produce identical ciphertext blocks!
β’ Pattern Leak: Directly reveals bitmap shapes (e.g., the ECB Penguin).
β’ Parallelizable: Yes (Encrypt & Decrypt) | Integrity: None. Insecure.
2. CIPHER BLOCK CHAINING (CBC):
β’ Equation: C_i = E_K(P_i (+) C_(i-1)), with C_0 = IV (Initialization Vector)
β’ Decryption: P_i = D_K(C_i) (+) C_(i-1)
β’ IV Requirement: Must be unpredictable and cryptographically random per message!
β’ Parallelizable: Decryption only | Error Propagation: 1-bit error in C_i corrupts P_i and flips bit in P_(i+1).
β’ Vulnerability: Padding Oracle attacks (POODLE / Vaudenay) if MAC check is omitted.
3. COUNTER MODE (CTR):
β’ Equation: C_i = P_i (+) E_K(Nonce || Counter_i)
β’ Converts block cipher into a deterministic stream cipher.
β’ Parallelizable: Yes (Encrypt & Decrypt) | Random Access: Yes (decrypt any block directly).
β’ Invariant: Nonce must NEVER be reused with the same key; reuse breaks confidentiality via XOR analysis.
4. GALOIS/COUNTER MODE (GCM):
β’ Combines CTR mode encryption with Galois Field GMAC authentication tags.
β’ Authenticated Encryption with Associated Data (AEAD).
β’ Provides Confidentiality, Integrity, and Authenticity simultaneously.
β’ High Performance: Pipelineable in hardware with sub-cycle AES-NI and CLMUL instructions.
cryptography library. Implements legacy AES-CBC with PKCS#7 padding and modern authenticated AES-GCM with Associated Data (AAD), comparing security guarantees and padding requirements.
import os
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives import padding
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
# ==============================================================================
# PIPELINE 1: LEGACY AES-256-CBC WITH PKCS#7 PADDING
# ==============================================================================
def encrypt_aes_cbc(key: bytes, plaintext: bytes) -> tuple:
# 16-byte random IV for 128-bit block size
iv = os.urandom(16)
# Apply PKCS#7 padding to align with 128-bit block boundaries
padder = padding.PKCS7(128).padder()
padded_data = padder.update(plaintext) + padder.finalize()
cipher = Cipher(algorithms.AES(key), modes.CBC(iv))
encryptor = cipher.encryptor()
ciphertext = encryptor.update(padded_data) + encryptor.finalize()
return iv, ciphertext
def decrypt_aes_cbc(key: bytes, iv: bytes, ciphertext: bytes) -> bytes:
cipher = Cipher(algorithms.AES(key), modes.CBC(iv))
decryptor = cipher.decryptor()
padded_data = decryptor.update(ciphertext) + decryptor.finalize()
# Remove PKCS#7 padding
unpadder = padding.PKCS7(128).unpadder()
return unpadder.update(padded_data) + unpadder.finalize()
# ==============================================================================
# PIPELINE 2: MODERN AUTHENTICATED AES-256-GCM (NO PADDING REQUIRED)
# ==============================================================================
def encrypt_aes_gcm(key: bytes, plaintext: bytes, aad: bytes) -> tuple:
# 96-bit (12-byte) unique nonce per NIST SP 800-38D
nonce = os.urandom(12)
aesgcm = AESGCM(key)
# GCM computes 128-bit authentication tag and appends to ciphertext
ciphertext_with_tag = aesgcm.encrypt(nonce, plaintext, aad)
return nonce, ciphertext_with_tag
def decrypt_aes_gcm(key: bytes, nonce: bytes, ciphertext_with_tag: bytes, aad: bytes) -> bytes:
aesgcm = AESGCM(key)
# Automatically validates authentication tag; throws InvalidTag if modified
return aesgcm.decrypt(nonce, ciphertext_with_tag, aad)
if __name__ == "__main__":
key_256 = os.urandom(32) # 256-bit symmetric key
secret_payload = b"STUDENT_ACADEMIC_RECORD_CGPA_9.88"
aad_header = b"Tenant-Pune-West"
# CBC Test
iv_cbc, ct_cbc = encrypt_aes_cbc(key_256, secret_payload)
pt_cbc = decrypt_aes_cbc(key_256, iv_cbc, ct_cbc)
print(f"[*] AES-256-CBC Recovered: {pt_cbc.decode('utf-8')}")
# GCM Test
nonce_gcm, ct_gcm = encrypt_aes_gcm(key_256, secret_payload, aad_header)
pt_gcm = decrypt_aes_gcm(key_256, nonce_gcm, ct_gcm, aad_header)
print(f"[β] AES-256-GCM Recovered: {pt_gcm.decode('utf-8')}")
SYMMETRIC ENCRYPTION DEFECTS & ARCHITECTURAL CORRECTIONS:
// ==============================================================================
// PITFALL 1: STATIC / REUSED INITIALIZATION VECTOR (IV) IN CBC OR GCM
// DEFECT: byte[] iv = new byte[16]; // All zeros used for every encryption!
// PROBLEM IN CBC: Allows attackers to detect if two plaintexts share an identical
// starting prefix (C_1 = E_K(P_1 ^ IV)).
// CATASTROPHE IN GCM: Nonce reuse completely destroys the GMAC authentication key!
// An attacker can forge arbitrary ciphertext tags and decrypt payloads (Joux's Forgery).
// FIX: Always generate a fresh, cryptographically secure random nonce per operation:
// byte[] iv = SecureRandom.getInstanceStrong().nextBytes(12);
// ==============================================================================
// ==============================================================================
// PITFALL 2: UNPROTECTED CBC MODE WITHOUT INTEGRITY (PADDING ORACLE ATTACKS)
// DEFECT: Application decrypts CBC ciphertext and returns detailed error responses:
// "HTTP 500: Invalid PKCS#7 Padding" vs "HTTP 200: Decrypted Successfully".
// ATTACK: Vaudenay Padding Oracle (POODLE). An active attacker systematically
// queries the endpoint, modifying ciphertext bytes to reveal the entire plaintext
// without knowing the encryption key!
// FIX: Always use Encrypt-then-MAC (HMAC-SHA256) or switch to AEAD (AES-GCM).
// ==============================================================================
// ==============================================================================
// PITFALL 3: KEY DERIVATION VIA WEAK HASHING INSTEAD OF KDF
// DEFECT: SecretKeySpec key = new SecretKeySpec(sha256(password.getBytes()), "AES");
// PROBLEM: Passwords have low entropy. SHA-256 is designed for fast hashing, allowing
// GPU clusters to compute billions of guesses per second during brute-force attacks!
// FIX: Derive symmetric keys using memory-hard Key Derivation Functions:
// Argon2id, PBKDF2WithHmacSHA256 (600,000+ iterations), or scrypt!
// ==============================================================================
SYMMETRIC ENCRYPTION SPECIFICATION MATRIX:
βββββββββββββββββββββββββββ¬βββββββββββββββ¬βββββββββββββββ¬βββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β CIPHER ALGORITHM β BLOCK SIZE β KEY LENGTH(S)β ROUND COUNT β ARCHITECTURAL PRIMITIVE β
βββββββββββββββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββββββββββββββββββββββββ€
β DES (Data Encryption) β 64 bits β 56 bits (eff)β 16 rounds β Feistel Network, S-Box / P-Box β
β β β 64 bits (raw)β β Insecure: 56-bit key space β
βββββββββββββββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββββββββββββββββββββββββ€
β 2DES (Double-DES) β 64 bits β 112 bits β 32 rounds β Insecure: Broken by Meet-in- β
β β β β β the-Middle attack (2^57 work) β
βββββββββββββββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββββββββββββββββββββββββ€
β 3DES (Triple-DES/TDEA) β 64 bits β 112 or 168 b β 48 rounds β Feistel E-D-E configuration β
β β β β β Legacy; Sweet32 block leak β
βββββββββββββββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββββββββββββββββββββββββ€
β AES-128 (Rijndael) β 128 bits β 128 bits β 10 rounds β Substitution-Permutation (SPN) β
β β β β β Galois Field GF(2^8) math β
βββββββββββββββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββββββββββββββββββββββββ€
β AES-192 (Rijndael) β 128 bits β 192 bits β 12 rounds β Substitution-Permutation (SPN) β
β β β β β High-assurance enterprise β
βββββββββββββββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββββββββββββββββββββββββ€
β AES-256 (Rijndael) β 128 bits β 256 bits β 14 rounds β Substitution-Permutation (SPN) β
β β β β β Quantum-resistant symmetric β
βββββββββββββββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββΌβββββββββββββββββββββββββββββββββββββ€
β ChaCha20 β Stream Cipherβ 256 bits β 20 rounds β ARX (Add-Rotate-XOR) design β
β β (64-byte blk)β β β High software speed, mobile β
βββββββββββββββββββββββββββ΄βββββββββββββββ΄βββββββββββββββ΄βββββββββββββββ΄βββββββββββββββββββββββββββββββββββββ€
β TOP 5 SYMMETRIC ENCRYPTION AXIOMS: β
β 1. AES Block Size is always 128 bits: Regardless of whether key length is 128, 192, or 256 bits. β
β 2. Never use ECB Mode: It leaks structural data patterns; use authenticated AEAD modes like GCM. β
β 3. Never reuse a Nonce/IV: Nonce reuse under CTR or GCM mode compromises confidentiality and auth. β
β 4. Defend against Meet-in-the-Middle: Cascading identical ciphers requires independent intermediate keys. β
β 5. Authenticate alongside Encryption: Unauthenticated ciphertext is vulnerable to chosen-ciphertext. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ