Symmetric Cryptography ยท 2.3
๐งฎ Symmetric Algorithms: DES, 3DES, AES
From 56-bit failure to 256-bit gold standardโฑ ~4 min
DES โ Data Encryption Standard (1977, now broken)
DES was the first publicly standardized encryption algorithm, developed by IBM and adopted by NIST in 1977. It uses a 56-bit key and 16 rounds of a Feistel network structure.
| Property | Value |
|---|---|
| Key size | 56 bits effective (64-bit key, 8 bits are parity) |
| Block size | 64 bits (8 bytes) |
| Rounds | 16 |
| Status | โ Broken โ 56-bit key brute-forced in 22 hours in 1999 (EFF DES Cracker) |
โ WarningNever use DES. A 56-bit key gives only 2^56 โ 72 quadrillion possible keys. A modern GPU cluster can try all of them in hours. DES is deprecated and prohibited in all modern security standards.
3DES (Triple DES) โ A Stopgap That Overstayed Its Welcome
3DES applies DES three times with different keys (Encrypt-Decrypt-Encrypt with keys K1, K2, K3). This extends the effective key length to 112 bits (in two-key mode) or 168 bits (three-key mode).
| Property | Value |
|---|---|
| Key size | 112 bits (2-key) or 168 bits (3-key) |
| Block size | 64 bits โ vulnerable to sweet32 birthday attack on long sessions |
| Speed | 3ร slower than DES, roughly 12ร slower than AES |
| Status | โ ๏ธ Deprecated by NIST in 2023 โ migrate to AES immediately |
AES โ Advanced Encryption Standard (2001, current gold standard)
โ
FactAES was selected in 2001 after a 5-year public competition run by NIST. The winner โ Rijndael, designed by Belgian cryptographers Joan Daemen and Vincent Rijmen โ beat 14 other candidates through public cryptanalysis. No significant attack on AES has been found in 25 years of intense scrutiny.
| Variant | Key Size | Rounds | Use |
|---|---|---|---|
| AES-128 | 128 bits | 10 | General use โ considered secure for most purposes |
| AES-192 | 192 bits | 12 | Rarely used; slight security margin increase |
| AES-256 | 256 bits | 14 | High-security use: government, military, disk encryption |
How AES Works Internally
- โขSubBytes โ each byte replaced via a non-linear S-box lookup table (confusion)
- โขShiftRows โ rows of the 4ร4 state matrix are cyclically shifted left (diffusion)
- โขMixColumns โ each column multiplied by a fixed matrix over GF(2^8) (diffusion)
- โขAddRoundKey โ the state XORed with the round key derived from the main key (key injection)
- โขThese four steps repeat for 10/12/14 rounds; the final round skips MixColumns
๐ SecurityAES-256 with a strong random key has never been practically broken. Even the best known theoretical attack (biclique cryptanalysis) only reduces the work factor from 2^256 to 2^254 โ still completely infeasible. For context, 2^256 operations would require more energy than exists in the observable universe.
Practical AES Usage
python
# Python โ AES-GCM encryption using cryptography libraryfrom cryptography.hazmat.primitives.ciphers.aead import AESGCMimport os # Generate a random 256-bit keykey = os.urandom(32) # 32 bytes = 256 bits # Generate a random 96-bit nonce (must NEVER be reused with same key)nonce = os.urandom(12) # 12 bytes = 96 bits (standard for GCM) aesgcm = AESGCM(key) # Encrypt โ returns ciphertext + 16-byte authentication tagciphertext = aesgcm.encrypt(nonce, b'Hello, World!', None) # Decrypt โ raises exception if tag verification failsplaintext = aesgcm.decrypt(nonce, ciphertext, None)print(plaintext) # b'Hello, World!'๐ง Quick Checkfirst try = +5 XP
Why is DES no longer used?
๐ฎ Practice what you learned
โญ 0 XP๐ฅ 0 days