Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Cryptographic Concepts Cheatsheet

This cheatsheet is designed as a quick mental map. For detailed explanations and Rust code, see Part 2 and Part 3 of this book.


🔐 Core Principles

ConceptSummary
Kerckhoffs’ PrincipleA cryptosystem must be secure even if everything except the key is known
Shannon’s MaximThe enemy knows the system — don’t rely on obscurity
Perfect SecrecyCiphertext reveals no information without the key (e.g., OTP)
Semantic SecurityAn attacker can’t learn anything new from ciphertext

🔢 Mathematical Foundations

ConceptSummary
EntropyA measure of randomness; critical for secure key generation
Modular ArithmeticMath used in most crypto (e.g., a mod n)
Finite FieldsAlgebraic structures where crypto operations like ECC take place
Primes & FactorizationBasis for RSA’s difficulty: factoring large numbers is hard
Discrete Log ProblemHardness assumption behind Diffie-Hellman and ECC

🔄 Encryption Concepts

ConceptSummary
Symmetric EncryptionSame key used for encryption and decryption (e.g., AES)
Asymmetric EncryptionPublic-key systems like RSA and ECC
Block CipherEncrypts fixed-size blocks (e.g., AES-128)
Stream CipherEncrypts bit-by-bit or byte-by-byte (e.g., ChaCha20)
Modes of OperationTechniques to apply block ciphers to arbitrary-length data (e.g., CBC, GCM)
PaddingFills the last block in block cipher (e.g., PKCS#7)

🔁 Cryptographic Properties

ConceptSummary
ConfusionMakes the relationship between key and ciphertext complex
DiffusionSpreads the influence of each input bit across the ciphertext
Avalanche EffectSmall change in input → large change in output
Deterministic EncryptionSame ciphertext for same input+key — not semantically secure
Non-deterministic EncryptionIncludes randomness (like IVs) to ensure unique ciphertexts

🔐 Hash Functions

ConceptSummary
Collision ResistanceIt’s hard to find two different inputs with the same hash
Preimage ResistanceGiven a hash, it’s hard to find an input that produces it
Second Preimage ResistanceGiven an input, hard to find another that hashes to the same value
Birthday ParadoxHash collisions can happen surprisingly early (~2^n/2 complexity)
Merkle–Damgård ConstructionA method used in many hash functions like SHA-1, SHA-256

🔏 Digital Signatures

ConceptSummary
AuthenticityVerifies that the message comes from the claimed sender
Non-repudiationSigner cannot deny having signed
ECDSA / RSA SignaturesAlgorithms for digital signatures using asymmetric keys

📡 Protocol Concepts

ConceptSummary
Key ExchangeSecurely establishing a shared key over an insecure channel (e.g., Diffie-Hellman)
Forward SecrecyCompromise of one key doesn’t expose past sessions
Replay AttackRe-sending valid data to trick the system again
Man-in-the-MiddleAttacker intercepts communication between two parties
NonceA number used once — prevents replay attacks and ensures uniqueness
Initialization Vector (IV)Random value to ensure unique ciphertexts in block cipher modes

🛡️ Attack Models

ConceptSummary
Ciphertext-only attackAttacker only has access to encrypted messages
Known-plaintext attackAttacker knows some plaintext–ciphertext pairs
Chosen-plaintext attackAttacker can choose plaintexts and get their ciphertexts
Chosen-ciphertext attackAttacker can decrypt chosen ciphertexts
Side-channel attackExploits physical leaks (timing, power, EM radiation)