Learn cryptography via Python3
Learn cryptography via Python3
There is a steep learning curve for learning cryptography, specifically zero knowledge proof. Qi zhou shared a great learning method: learning it via programming.
Every time you learn a cryptographic primitive, get a corresponding code, and see the principle.
- Observe programming examples
- Modify the program and see different results
- Early performance benchmark
- practice the usage of functions, and writing Examples Start your project - KZG, Plonk, etc.
Python is a scripting language with native big integer support, which is easy to implement crypto ideas.
Many famous cryptography researchers, including Vitalik, are using python3, and Ethereum 2.0 spec is also written in Python3
Good libraries:
-
a lot of treasuries, Fq, polynomial over Fq, FFT
ethereum/py_pairing: Elliptic curve operations, including pairings
ethereum/py_ecc: Python implementation of ECC pairing and bn_128 and bls12_381 curve operations
bls-signatures/python-impl at main · Chia-Network/bls-signatures · GitHub
Chia’s BLS library with ECC
Common used libraries
1 | from basic_crypto.poly_utils import PrimeField # operation at or between polynomials |
For polynomial over Prime field
The prime root for the root of unity of BLS12-381 can be 5 or 7.
TODO