📐 Formula & Logic Cheat Sheet
Exam Rule
Always show your working. If you forget the exact number, write down the formula you are trying to use to get partial marks.
1. Risk Management (Week 1)
This cheat sheet details the mathematical formulas and strict logical processes for risk assessment and management found in the sources.
| Formula/Steps | Variable Definitions | Worked Example |
|---|---|---|
| Risk Associated with Vulnerabilities (Working Definition) | ||
| Risk: The possibility to suffer harm or loss. | If the impact (I) of data exposure is rated 5 (High) and the probability (P) of the exploit occurring is rated 3 (Medium): | |
| Annualized Loss Expectancy (ALE) Calculation | ||
| ALE: Annualized Loss Expectancy (the total expected loss over one year). | Scenario: Calculate ALE for Teller Cash theft. | |
| Expected loss: The financial amount lost per incident (e.g., $3,240 for Teller Cash). | Expected loss: $3,240 | |
| Number of incidents expected (Incidence): The estimated frequency of the event occurring in an average year (e.g., 200 for Teller Cash). | Incidence: 200 | |
| 3,240 \times 200 = | ||
| Risk Assessment (Strict Logical Process) | ||
| 1. Identify assets, threat agents, and threats to assets,. | Asset: What is being protected (e.g., data, physical items, people),. | 1. Identify: Asset is the sensitive customer database. Threat Agent is an external attacker. Threat is a system breach/data exposure. |
| 2. Identify vulnerabilities that can be exploited,. | Threat Agent: Who is the attacker (e.g., organized criminals, nation states),. | 2. Identify: Vulnerability is the lack of redundancy for the database back-end, which creates a single point of failure,. |
| 3. Measure probability of occurrence and impact (potential loss) of exploits,. | Vulnerability: A weakness that can be used to harm us. | 3. Measure: Probability of failure is moderate. Impact (loss of ability to process payments) is high. |
| Risk Mitigation (Strict Logical Process) | ||
| 1. Prioritise the risks. | Risk: The possibility of suffering harm or loss. | 1. Prioritise: The risk of data loss due to database failure is critical (High Priority). |
| 2. Identify countermeasures. | Countermeasures: Means (controls) to detect, deter, or deny attacks,. | 2. Identify: Implement physical controls (backup power generators) and logical controls (redundancy for the database),. |
| 3. Evaluate the countermeasures: How well they reduce risk; how expensive they are; what new risks/trade-offs they bring. | Trade-offs: New risks or diminished productivity resulting from implementation,. | 3. Evaluate: Redundancy significantly reduces downtime risk but incurs high implementation and maintenance expense. |
| 4. Implement countermeasures (and stay within a given budget). | Budget: Financial constraint for implementing security measures. | 4. Implement: Deploy the redundant database back-end and operational procedures to maintain it. |
| Incident Response (Strict Logical Process) | ||
| The process consists of six phases: | Preparation: Activities performed in advance of an incident (e.g., documentation, training). | Preparation: Develop an incident response plan for malware infection. |
| 1. Preparation. | Detection and analysis: Identifying an issue and determining if it constitutes an incident. | Detection: IDS/AV alerts on a malware infection. |
| 2. Detection and analysis. | Containment: Taking steps to prevent further damage (e.g., disconnecting a server),. | Containment: Disconnect the infected server from the network. |
| 3. Containment. | Eradication: Removing the effects of the issue from the environment (e.g., removing malware). | Eradication: Remove the malware and scan other hosts for infection,. |
| 4. Eradication. | Recovery: Restoring devices or data to a working state, better than before the incident began. | Recovery: Restore the server and data from clean backup media. |
| 5. Recovery. | Post incident activity: Determining what happened, why, and how to prevent recurrence (postmortem). | Post Incident: Update administrative controls/policies to address the vulnerability used in the attack. |
2. Symmetric Cryptography (Week 3)
| Formula/Steps | Variable Definitions | Worked Example |
|---|---|---|
| Formal Encryption Scheme Correctness Condition | ||
| : Encryption algorithm. : Decryption algorithm. : A specific key in the key set . : Plaintext message in the set . | None provided in the source for this formal definition. | |
| Shift Cipher (Caesar Cipher) | ||
| : Ciphertext letter (0-25). : Plaintext letter (0-25). : Key (fixed shift amount). | Plaintext (15) added to key (20) gives 35. , which corresponds to ciphertext . | |
| One-Time Pad (OTP) Encryption/Decryption | ||
| Encryption: ,. Decryption: ,. Correctness: . | : Truly random key stream. : Plaintext string. : Ciphertext string. : Bitwise XOR operator,. | Plaintext (binary: ) XORed () with random key (binary: ) yields ciphertext (binary: ). |
| OTP Key Reuse Vulnerability (Attack) | ||
| : Two distinct plaintexts encrypted with the same key . : Ciphertext result. | If a key stream is used twice, XORing the two ciphertexts reveals the difference between the plaintexts (),. | |
| Shannon’s Theorem (Key Space Minimum) | ||
| $ | K | \geq |
| Counter (CTR) Mode Keystream Generation | ||
| Keystream blocks are generated by or ,. Encryption: . | : Block cipher encryption function under key . : Initialization Vector (starting counter value). : The counter increment (). : Plaintext and ciphertext blocks. | The keystream is generated by encrypting and then XORing this entire pseudorandom stream with the plaintext blocks. |
| Cipher-Block Chaining (CBC) Mode | ||
| Encryption: . Decryption: . | : Encryption function under key . : Decryption function. : Current plaintext block. : Current ciphertext block. : Previous ciphertext block ( is the IV). : XOR operator. | None provided. CBC encryption starts by XORing the first plaintext block () with a random (IV) before encryption. |
| Merkle-Damgård Iteration (Hash Construction) | ||
| Iteration: $v_i := f(v_{i-1} | Final Hash: . | : Compression function ( bits bits). : Intermediate hash value (-bits). : Initial -bit hash value. : Message block (-bits). : Total number of message blocks after padding. $ |
| Birthday Attack Calculation (Hash) | ||
| Expected Collisions computations,. | : Length of the hash output in bits (e.g., 128 for MD5 or 160 for SHA-1). : The square root of the total hash space . | For a 128-bit hash function (like MD5), finding a collision requires about hash computations. For SHA-1 (160 bits), the brute-force maximum effort is . |
| Message Authentication Code (HMAC) | ||
| $\text{HMAC}(k,m) = h((k \oplus \text{opad}) | h((k \oplus \text{ipad}) | m))$,. |
| DES Feistel Round Function (Inversion) | ||
| Forward (Input , Key ): Output , . Reverse (Input , Key ): Output , . | : Left and right halves of input block. : Left and right halves of output block. : Round function. : Round key. : XOR operator. | Decryption of the Feistel function requires applying the same round function in reverse order using the ciphertext half to recover the plaintext half ,. |
| RSA Asymmetric Cryptography | ||
| Encryption: . Decryption: . Signature: . | : Message. : Ciphertext. : Public modulus (). : Public exponent (Encryption key). : Private exponent (Decryption key). | The core mathematical operation relies on finding such that , where . |
| Discrete Logarithm Problem | ||
| : Large prime number. : Primitive root (generator). : Discrete logarithm (secret exponent). : Public result. | When working modulo 7, using generator , . The discrete logarithm of 6 is 3. | |
| Diffie-Hellman Shared Secret Generation | ||
| Shared Secret: . | : Publicly known generator and prime. : Alice’s and Bob’s secret exponents. and are the public keys. | Alice computes and Bob computes , both resulting in the shared secret . |
| Shannon’s Discrete Entropy Formula | ||
| . | : Entropy (measure of choice/uncertainty). : Probability of the -th event. : Positive constant (determines unit of measure). | For two possibilities with probabilities and , the entropy is . |
| Shannon’s Noiseless Channel Capacity | ||
| . | : Channel capacity (bits per second). : Number of allowed signals of duration . | For symbols with durations , the capacity , where is the largest real solution of the characteristic equation: . |
3. Asymmetric Cryptography (Week 6)
I. RSA Cryptosystem
| Category | The Formula/Steps | Variable Definitions | Worked Example: Key Generation & Operations |
|---|---|---|---|
| Key Generation: Modulus | : RSA modulus,. : Large, random, distinct primes,,. | Setup: 1. Choose large distinct primes and , compute . 2. Compute . 3. Choose such that . 4. Compute such that using the Extended Euclidean Algorithm. | |
| Key Generation: Exponents | 1. ,,,. 2. Choose encryption exponent such that ,,. 3. Compute decryption exponent such that ,,. | : Euler phi function/Euler totient function, the number of integers prime to . : Encryption exponent (Public key component),. : Decryption exponent (Private/Secret key component),. | Factoring (If is known): and . |
| Encryption (Textbook RSA) | ,,,. | : Plaintext message (must be ),. : Ciphertext,. : Public key, . | The provided sources do not include a complete small-number textbook RSA example showing key generation, encryption, and decryption. |
| Decryption (Textbook RSA) | ,,,. | : Secret key, . | Correctness (Logical Process): The inverse property ensures ,. |
| Common-Modulus Attack | Find such that . Message recovery: . | : Encryption exponents of two users sharing the same modulus . : Ciphertexts of the same message encrypted with . | Steps rely on the Extended Euclidean Algorithm to find and . |
| Low-Encryption-Exponent Attack | Use CRT to compute (where ). If , compute by ordinary -th root (e.g., cube root in Z). | : Modulus of recipient . : Small encryption exponent (e.g., 3). | This logical process works if the same message is sent to multiple recipients with relatively prime moduli. |
| Modular Exponentiation | Compute efficiently using the Square and Multiply method,. The complexity is or if is an -bit number. | : Base. : Exponent. : Modulus. | Example step: . |
II. Diffie-Hellman & ElGamal Cryptosystems
| Category | The Formula/Steps | Variable Definitions | Worked Example (Modulo 17) |
|---|---|---|---|
| Diffie-Hellman (DH) Key Exchange | Shared Secret Key: (Alice’s computation),. (Bob’s computation),. | : A group (e.g., multiplication modulo a large prime). : A generator of . : Randomly chosen, secret exponents (Alice’s and Bob’s private keys, respectively),. : Public exchange values. | Setup: is multiplication , . Alice chooses . Bob chooses . Exchange: Alice sends . Bob sends ,. Shared Key: . . Equal key: . |
| ElGamal Encryption (Classic) | Ciphertext where: and ,. | : Group. : Generator. : Bob’s private key (secret exponent). : Bob’s public key, . : Alice’s randomly chosen secret exponent. : Plaintext message. : Shared secret key derived from DH. | Setup: is multiplication , . Bob private key , Public key . Alice chooses . Message ,. Encryption: Compute . . . Ciphertext . |
| ElGamal Decryption (Classic) | Compute shared secret key: ,. Recover plaintext: (division/multiplication by inverse). If working modulo prime , . | : First component of ciphertext (). : Second component of ciphertext (). : Bob’s private key. | Decryption: Bob computes . To find , he divides by . The resulting plaintext is . |
| ElGamal Signature: Signing | 1. Choose random such that . 2. . 3. . Signature is . | : Secret key exponent. : Prime modulus. : Random integer (Ephermeral key). | A worked example is requested but not provided in the source material for the ElGamal Signature scheme. |
| ElGamal Signature: Verification | 1. Compute . 2. Compute . 3. Accept if . | : Public key (). : Message (or hash of message). : Signature components. | Proof of Correctness: (Exponents are modulo ). |
III. Digital Signature Algorithm (DSA) & ECDSA
| Category | The Formula/Steps | Variable Definitions | Worked Example: Calculation Steps |
|---|---|---|---|
| DSA Signing | 1. Choose random , . 2. . 3. . Signature is . | : Large prime modulus. : Prime divisor of (order of subgroup ). : Element of order in . : Secret exponent (key). : Message (or hash of message). : Random integer. | A worked example is requested but not provided in the source material for the DSA signing steps. |
| DSA Verification | 1. Compute . 2. Compute . 3. Accept if . | : Public key (). : Signature components. : Multiplicative inverse of mod . | Proof of Correctness: . Since , then . Thus (since ). Therefore . |
| ECDSA Signing | 1. Choose random , . 2. Compute . . 3. . Signature is . | : Base point on elliptic curve of prime order ,. : Alice’s secret key (number). : Message element in . : Random integer. | A worked example is requested but not provided in the source material for the ECDSA signing steps. |
| ECDSA Verification | 1. Compute . 2. Compute and . 3. Compute verification point . 4. Accept if (where ). | : Alice’s public key point (). : Signature components. : Order of base point . : X-coordinate of point . | Proof of Correctness: . Substituting definitions gives . Thus and . |
| ECC Scalar Multiplication | Compute . Method is Double and Add. | : Scalar (number). : Point on the curve. | Double and Add Recursion: If is even: Compute . Result is . If is odd: Compute . Result is . |
IV. Other Relevant Processes & Functions
| Category | The Formula/Steps | Variable Definitions | Notes |
|---|---|---|---|
| Euclidean Algorithm (GCD) | Input: . 1. while do: . . . 2. return . | : Integers. : Remainder. | Computes the greatest common divisor. . |
| PKCS#1 V1.5 Encoding | $x = 00 | 02 | r |
| OAEP Encryption | 1. Choose random . 2. $x = (m \oplus G(r)) | (r \oplus h(m \oplus G(r)))c = f(x)$. | : Message ($ |
| OAEP Decryption | Given . 1. Compute $f^{-1}(c) = a | b | a |
| Paillier Encryption (Homomorphic) | . | : RSA modulus (). : Random element in Z_n^_. : Message in . : Element of order in Z_{n^2}^_. | Homomorphic property: . |
| Paillier Decryption | . . | : Secret key . | Requires knowledge of the secret key and prime factors to compute . |
| Euler Phi Function () | If (prime factorization), then . | : Integer. : Distinct prime factors. | If (two primes), . |
Analogy: Trapdoor Functions
The core mathematical concepts used in public-key cryptography—modular exponentiation (RSA) and discrete exponentiation (DH/ElGamal)—are based on one-way functions. These functions are like digital locks: they are easy to compute in one direction, but extremely hard to reverse,.
- Diffie-Hellman/ElGamal uses discrete exponentiation, which is a one-way function without a readily available shortcut: is easy to compute, but finding (the Discrete Logarithm) is hard. This is like mixing paint (easy to mix, hard to unmix).
- RSA uses modular exponentiation, which is a trapdoor one-way function: is easy to compute, but reversing it () is hard unless you have the secret key , which acts as the trapdoor,. The knowledge of the prime factors and of (the second one-way function, factoring) creates this trapdoor. This is analogous to a public lock: anyone can close it, but only the person with the private key can open it.
4. Logical Processes (Non-Math)
Digital Signature Verification (Week 7)
TCP Handshake (Week 2)
- SYN: Client Server (Seq = )
- SYN-ACK: Server Client (Seq = , Ack = )
- ACK: Client Server (Seq = , Ack = )