Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
duyuefeng0708
GitHub Repository: duyuefeng0708/Cryptography-From-First-Principle
Path: blob/main/frontier/11-homomorphic-encryption/README.md
483 views
unlisted

Module 11: Homomorphic Encryption

View on nbviewer

Computing on encrypted data, the holy grail of privacy preserving computation.

Prerequisites

Learning Objectives

After completing this module you will:

  1. Understand the fully homomorphic encryption (FHE) concept and the role of noise budgets

  2. Implement a partially homomorphic scheme (Paillier) supporting addition on ciphertexts

  3. Grasp how BGV and BFV manage noise through modulus switching and relinearization

  4. Understand CKKS approximate arithmetic for real number computation on encrypted data

Explore (SageMath Notebooks)

Work through these notebooks in order:

#NotebookWhat You'll Learn
aWhat Is FHE?The dream of computing on ciphertexts, noise growth, and bootstrapping
bPartially Homomorphic SchemesRSA (multiplicative) and Paillier (additive) as stepping stones to FHE
cBGV SchemeModulus switching to control noise in integer arithmetic
dBFV SchemeScale invariant variant of BGV with simpler noise management
eCKKS Approximate ArithmeticEncoding real numbers and tolerating approximate decryption

Implement (Rust)

Build these from scratch in rust/src/lib.rs:

#FunctionDescription
1paillier_keygenGenerate a Paillier public/private key pair from two large primes
2paillier_encryptEncrypt a plaintext integer under the Paillier public key
3paillier_addHomomorphically add two Paillier ciphertexts
4paillier_decryptDecrypt a Paillier ciphertext using the private key
5paillier_scalar_mulMultiply a Paillier ciphertext by a plaintext scalar

Run: cargo test -p homomorphic-enc

Break

Try these attacks in the break/ folder:

  • Exhaust noise budget in FHE. Chain enough homomorphic multiplications to push noise past the decryption threshold and observe garbled output.

  • CPA attack on deterministic encryption. Show that a homomorphic scheme without randomized encryption leaks plaintext equality.

Connect

See where this shows up in practice (in the connect/ folder):

  • FHE in privacy preserving machine learning. Train or infer on encrypted medical/financial data without exposing it.

  • Encrypted databases. Query encrypted records without the server ever seeing plaintext.

  • Microsoft SEAL and Google FHE compiler. Production libraries making FHE accessible to application developers.


Next: Module 12: Multi-Party Computation