Lecture 31:
Generalised ElGamal Public Key Cryptosystem
Setup (General)
-
Cyclic group:
G
-
Generator:
α
-
Private key:
a
-
Public key:
β=αa
-
Public:
(G,α,β)
Encryption
Choose random:
k
Ciphertext:
y1=αk
y2=x⋅βk
Decryption
x=y2⋅(y1a)−1
Core Hard Problem
β=αa⇒find a
(Discrete Log Problem)
Elliptic Curve Version
Keys
-
Generator point:
α
-
Private key:
a
-
Public key:
β=aα
Encryption (ECC)
Choose random:
k
y1=kα
y2=x+kβ
Decryption
x=y2−ay1
Example Values
-
p=11
-
Curve:
y2≡x3+x+6(mod11)
-
Generator:
α=(2,7)
-
Private:
a=7
-
Public:
β=(7,2)
Encryption Example
Message:
x=(10,9)
Random:
k=3
y1=(8,3)
y2=(10,2)
Decryption
x=(10,2)−7(8,3)=(10,9)
Notes
Lecture 32:
Chinese Remainder Theorem
Linear Equations (mod p)
Given:
4x+7y≡9(mod13)
5x+2y≡3(mod13)
Steps
4−1≡10(mod13)
5−1≡8(mod13)
x+5y≡12(mod13)
x+3y≡11(mod13)
Subtract
2y≡1(mod13)
y≡7(mod13)
Substitute
x=12−5y≡3(mod13)
Solution
x=3,y=7
Chinese Remainder Theorem (2 equations)
Given:
x≡a(modm)
x≡b(modn)
Condition:
gcd(m,n)=1
x=a+tm
Substitute:
a+tm≡b(modn)
Solve for ( t )
t≡m−1(b−a)(modn)
Final Solution
x=a+tm(modmn)
Example
x≡3(mod5)
x≡5(mod7)
Compute
5−1≡3(mod7)
t=3(5−3)≡6(mod7)
Result
x=3+5⋅6=33
x≡33(mod35)
General CRT (r equations)
Given:
x≡ai(modmi)
Condition:
gcd(mi,mj)=1
Define
M=∏mi
Mi=miM
yi=Mi−1(modmi)
Solution
x=∑aiMiyi(modM)
Key Properties
Key Insight
- Break big modulus into smaller ones
- Solve separately
- Combine using CRT
Final Note
-
Used in:
- RSA optimization
- Cryptographic computations
Lecture 33:
Rabin Cryptosystem
Quadratic Residue
Definition:
a is quadratic residue mod p⟺∃y: y2≡a(modp)
Euler Criterion
a2p−1≡1(modp);;⇒;;a is QR
a2p−1≡−1(modp);;⇒;;a is non-QR
Square Root (Special Case)
If:
p≡3(mod4)
Then:
y≡±a4p+1(modp)
Key Generation
p≡q≡3(mod4)
n=pq
n
(p,q)
Plaintext Space
x∈Zn∗
Encryption
y≡x2(modn)
Decryption
Solve:
x2≡y(modn)
Using CRT:
x2≡y(modp)
x2≡y(modq)
Roots
From each:
x≡±y4p+1(modp)
x≡±y4q+1(modq)
Total Solutions
4 possible values of x
Example
Given:
p=7,;q=11,;n=77
Ciphertext:
y=23
Solve
x2≡23(mod7)
x2≡23(mod11)
Final Solutions
x∈10,32,45,67
Key Points
- Not injective → 1 ciphertext → 4 plaintexts
- Requires guessing / redundancy
- Based on square root modulo problem
Insight
-
Uses:
- CRT
- Quadratic residues
- Modular square roots
-
Limitation:
- Ambiguity (4 solutions) → not widely used
Lecture 34:
Legendre and Jacobi Symbol
Quadratic Residues Count
- In ( Zp ) (p prime):
∣QR∣=∣Non-QR∣=2p−1
Construction
Set:
12,22,...,(2p−1)2modp
✔ Gives all quadratic residues
Legendre Symbol
(pa)={0p∣a 1a is QR mod p −1a is non-QR mod p
Euler Relation
(pa)≡a2p−1modp
Multiplicative Property
(pmn)=(pm)(pn)
Special Values
For ( -1 )
(p−1)=(−1)2p−1
-
(= 1) if:
p≡1(mod4)
-
(= -1) if:
p≡3(mod4)
For ( 2 )
(p2)=(−1)8p2−1
-
(= 1) if:
p≡±1(mod8)
-
(= -1) if:
p≡±3(mod8)
Congruence Property
If:
a≡b(modp)
Then:
(pa)=(pb)
Jacobi Symbol
For:
n=p1e1p2e2⋯pkek
Define:
(na)=(p1a)e1(p2a)e2⋯(pka)ek
Properties (Jacobi)
(nab)=(na)(nb)
(mna)=(ma)(na)
Quadratic Reciprocity
(nm)(mn)=(−1)4(m−1)(n−1)
Key Insight
-
Fast QR checking using:
a2p−1modp
-
Used in:
- Primality testing
- Cryptography
Note
- Jacobi ≠ guarantee of QR
- Only:
(na)=−1⇒non-QR
Use
- Efficient computation of residue properties
- Important in crypto algorithms
Lecture 35:
Jacobi Symbol (Contd.)
Jacobi Symbol Computation
Given:
(na),n=p1e1p2e2⋯pkek
(na)=(p1a)e1(p2a)e2⋯(pka)ek
Example Structure
For:
n=9975=3⋅52⋅7⋅19
(99756278)=(36278)(56278)2(76278)(196278)
✔ Reduce using:
a≡b(modp)
Euler-Based Check
(pa)≡a2p−1modp
Euler Pseudoprime
If:
(na)≡a2n−1modn
Then:
- (n) behaves like prime for base (a)
- Called Euler pseudoprime
Solovay–Strassen Test
Steps:
- Choose random:
a∈[1,n−1]
- Compute:
x=(na)
- Compute:
y≡a2n−1modn
Decision:
x=0
→ (n) is composite
y≡xmodn
→ (n) is composite
→ (n) is probably prime
Property
- If algorithm says composite → always correct
- If prime → probabilistic
Goldwasser–Micali Cryptosystem
Key Generation
p,q
n=pq
m such that (pm)=−1,;(qm)=−1
Then:
(nm)=1
✔ (m) = pseudo-quadratic residue
Public Key
(n,m)
Private Key
(p,q)
Encryption
Plaintext:
x∈0,1
Choose random:
r∈Zn∗
Ciphertext:
y≡r2⋅mxmodn
Decryption
Check QR:
y is QR mod p and q
→
x=0
x=1
Key Insight
-
Security based on:
- Difficulty of distinguishing QR vs non-QR
- Without knowing (p, q)
Important Note
- Jacobi = 1 does NOT guarantee QR
- Used to hide bit information securely
Use
- Probabilistic primality testing
- Bit encryption scheme (GM cryptosystem)