This is a workbook for 0xPARC's Introduction to Programmable Cryptography (PDF) book. Its main objective is to help readers follow the book and its concepts. The Jupyter Notebooks directly translate the algorithms and examples mentioned in the book, written in the most straightforward manner possible (i.e., no optimizations).
For Chapter 4, please refer to 0xPARC's PlonKathon which contains related exercises. You can also see my PlonKathon blog post for hints.
Thank you to the book's authors, Evan Chen and Brian Lawrence for their feedback. Thank you to 0xPARC for sponsoring this project.
This project's dependencies are managed by Poetry.
pipx install poetry
If the above doesn't work, see here for additional instructions on Poetry installation.
poetry install
All notebook files are in the src
folder and can be run inside a Jupyter Lab environment.
To start JupyterLab:
jupyter-lab
Then open the jupyter notebook files inside the \src
folder
There are unittest files for certain chapters.
Run all test files:
poetry run pytest
Run test for specifc chapter:
poetry run pytest tests/test_ch_6_oram.py
- Code companion to text
- Ch 2: 2PC
- 2.1.3 Garbled gates
- 2.1.4 Chaining garbled gates
- 2.1.5 How Bob uses one gate
- Example: How to chain 2 garbled gates
- 2.2.1 Commutative encryption
- 2.2.3 OT in one step
- Example: How to combine garbled circuits and OT
- Ch 3: EC & PCS
- 3.2.2 EdDSA Signature Scheme
- 3.2.3 Pedersen Commitments
- 3.4 KZG Commitments
- Ch 5: FHE
- 5.3 Public Key Cryptography from LWE Example
- 5.4.3 The "Flatten" Operation
- Ch 6: ORAM
- 6.3 Binary Tree ORAM
- 6.7 Path ORAM
- Other Ideas:
- 6.6 Recursive ORAM
- Encryption and decryption on blocks
- Ch 2: 2PC
- Exercises