Compared with symmetric encryption, asymmetric encryption is:
Asymmetric Cryptography: RSA and Hash Functions
Symmetric vs. asymmetric, public and private keys, trapdoor one-way functions, RSA (key generation, encryption, decryption, signatures, worked examples), and hash functions (SHA, MD, collisions) vs. MACs vs. signatures. Final 221 B and Major 181 asked about keys, signatures and hash lengths.
How to read this page
Every original slide is shown unchanged. Yellow marks on a slide point to a numbered note: hover or tap a mark to jump to its note, and hover a note to see its marks. Questions tagged Past exam appeared on a real paper; Prediction questions are likely angles, not confirmed. Pick an answer to each question: a wrong pick tells you why it is wrong, so you can try again.
All 37 slides
- 1 Encryption and Cryptography (2)
- 2 Agenda
- 3 Objectives
- 4 Symmetric Cryptography Versus Asymmetric Cryptography
- 5 Symmetric Cryptography Versus Asymmetric Cryptography
- 6 Asymmetric Key Cryptography / Public Key Encryption
- 7 Keys
- 8 General Idea
- 9 Trapdoor One-Way Function
- 10 RSA CRYPTOSYSTEM
- 11 RSA Encryption...
- 12 RSA Decryption...
- 13 RSA Continued
- 14 RSA: Key Generation
- 15 RSA Procedure
- 16 Basic Concepts: Extended Euclidean Algorithm
- 17 RSA Application
- 18 RSA: Some Trivial Examples
- 19 RSA Example 2:
- 20 RSA Homework Practice:
- 21 Encryption
- 22 Slide 22
- 23 RSA for Encryption - Encrypt using public key - Decrypt using private key
- 24 RSA Signature
- 25 RSA Security
- 26 Data Integrity: Hash Functions
- 27 Hash Functions
- 28 Hash Functions
- 29 Hash Function vs Message Authentication Code (MAC
- 30 Hash Functions
- 31 Secure Hash Algorithm (SHA)
- 32 Message Digest (MD)
- 33 Examples
- 34 Hash vs. MAC vs. Signature
- 35 Hash vs. MAC vs. Signature
- 36 Slide 36
- 37 Slide 37
Encryption and Cryptography (2)
Notes
Tip Which key? ENCRYPT for confidentiality with the RECEIVER’s public key (receiver decrypts with their private key). SIGN with the SENDER’s private key (anyone verifies with the sender’s public key).
Objectives
Notes
Objectives.
Symmetric Cryptography Versus Asymmetric Cryptography
Notes
Symmetric: one shared key, fast, key distribution problem. Asymmetric: key pair, slower, solves key exchange and enables signatures.
Exam angle
Symmetric Cryptography Versus Asymmetric Cryptography
Notes
Comparison table, continued.
Keys
Notes
Tip Which key? ENCRYPT for confidentiality with the RECEIVER’s public key (receiver decrypts with their private key). SIGN with the SENDER’s private key (anyone verifies with the sender’s public key).
Exam angle
MCQ · how the two keys relate
Related question: MCQ · which key decrypts the sports channel
Which statement about an asymmetric key pair is correct?
- Major 181.
General Idea
Notes
General idea: C = f(K_public, P); P = g(K_private, C).
Trapdoor One-Way Function
Notes
Trapdoor one-way function: easy to compute, infeasible to invert without the trapdoor (the private key).
Exam angle
The core idea behind public-key cryptography is the:
RSA: Key Generation
Notes
Tip RSA in 5 lines: pick primes p, q · n = p·q · φ(n) = (p−1)(q−1) · pick e coprime with φ(n) · d = e⁻¹ mod φ(n). Encrypt C = Mᵉ mod n; decrypt M = Cᵈ mod n.
Exam angle
With p = 5, q = 11, φ(n) equals:
- (5 − 1)(11 − 1) = 40.
With p = 5, q = 11 and e = 7, the private exponent d is:
- 7 × 23 = 161 = 4 × 40 + 1.
RSA Application
Notes
RSA application.
RSA: Some Trivial Examples
Notes
Example 1: p = 7, q = 11 → n = 77, φ = 60, e = 13, d = 37.
RSA Example 2:
Notes
Example 2: p = 3, q = 11 → n = 33, φ = 20, e = 7, d = 3.
Exam angle
RSA with p = 3, q = 11, e = 7. Find n, φ(n), d, and encrypt M = 2.
Compare with the model answer
n = 33, φ(n) = 20, d = 3 (7 × 3 = 21 ≡ 1 mod 20). C = 2⁷ mod 33 = 128 mod 33 = 29. Check: 29³ mod 33 = 2.
RSA for Encryption - Encrypt using public key - Decrypt using private key
Notes
Tip Which key? ENCRYPT for confidentiality with the RECEIVER’s public key (receiver decrypts with their private key). SIGN with the SENDER’s private key (anyone verifies with the sender’s public key).
Exam angle
MCQ · digital signature uses the sender’s private key
A digital signature is created by encrypting the message digest with:
- Major 181.
RSA Security
Notes
RSA security rests on how hard it is to factor n; key sizes keep growing (2048+ bits).
Hash Functions
Notes
A hash maps any input to a fixed-length digest; one-way (you can’t get the plaintext back).
Hash Functions
Notes
Uses: storing passwords, integrity checks, signatures.
Exam angle
written · two differences between hashing and encryption
How is hashing different from encryption? Give two differences. (Final 221 B)
Compare with the model answer
Hashing is one-way (no key, cannot be reversed) while encryption is reversible with a key; a hash always has a fixed-length output, while ciphertext length depends on the input.
Hash Function vs Message Authentication Code (MAC
Notes
Hash (no key, integrity only) vs. MAC (shared key: integrity + authenticity).
Secure Hash Algorithm (SHA)
Notes
SHA (NSA, NIST standard). SHA-1: 160-bit digest. SHA-2: 224–512. SHA-3: 224, 256, 384, 512 with a different internal structure (Keccak).
Exam angle
MCQ · SHA-3 hash lengths
SHA-1 produces a digest of:
Message Digest (MD)
Notes
MD (Message Digest) family: 128-bit hashes. MD4 is older and LESS secure than MD5.
Exam angle
MCQ · MD4 is older and less secure than MD5
MD5 produces a hash of:
Examples
Notes
Try hashing text online.
Hash vs. MAC vs. Signature
Notes
Hash = integrity. MAC = integrity + authentication (shared key). Signature = integrity + authentication + non-repudiation (private key).
Exam angle
Which provides non-repudiation?
Hash vs. MAC vs. Signature
Notes
Comparison continued.
Slide 36
Notes
Summary.
Slide 37
Notes
End.
Seen again Ch 6.2, slide 6: Digital certificates and PKI