Best Practices for Cryptography In Python
summary
Secure cryptography is possible in Python but only with tradeoffs: built-in pow() and big ints leak timing and memory, Python lacks direct control of caches and mlock, and pure Python exponentiation is vulnerable to timing attacks. Recommended approach is calling native libs via cffi or wheels to use OpenSSL/libsodium for constant‑time ops and AES hardware, using bytearray buffers and a context manager to autozero them; RSA e is commonly 65536 and pure‑Python crypto runs five or six orders of magnitude slower.
AI-written summary · about
chapters (10)
- 0:00Start
- 1:25Agenda
- 2:35What Cryptography Is
- 4:40The Scope
- 5:17Implementing Cryptographic Algorithms
- 8:30An Illustrative Example
- 20:46Let's ask a scientician
- 21:03Establish what matters
- 26:04Secure cryptography is possible in Python
- 26:32References/Links
related talks
34mPython bad cryptography habits
39mPython Security & Cryptography
28mModern Cryptography
36mUse Cryptography; Don't Learn It
24mWhy you shouldn't write crypto functions yourself
52mTales from the Crypt: A Cryptography Primer
47mFootguns and factorisation: how to make users of your cryptographic library successful
35mCooking with Cryptography
