Articles here
First Steps with Cryptography in Python: Hashing, HMAC, and AES-GCM
Three fundamentals with the standard library and the cryptography package — hashing with hashlib, message authentication with hmac, encryption with AES-GCM — plus the three beginner traps to avoid: ECB, home-grown randomness, and hashing-as-encryption.
PythonhashlibAES-GCMHMACcryptography
Encoding Formats in Practice: PEM, DER, Base64 and Hex, and How They Differ
In memory a key is an object; on disk and on the wire it must become bytes, and the same key material can wear several different outer layers — PEM, DER, Base64 and more. This tutorial walks through exporting and loading keys with the cryptography library's serialization interface and clears up the confusions that bite most often.
PythonPEMDEREncoding
Signing API Requests: HMAC in Practice with Full Replay Protection
Open APIs commonly use HMAC signatures to prove a request really came from the key holder and was not tampered with. This tutorial implements signing and verification for an API request end to end with the standard library's hmac module: a canonical signing string, timestamps and nonces against replay, constant-time comparison, and a dissection of the signing mistakes beginners make most.
PythonHMACAPI SigningReplay Protection
Property Tests for Crypto Code: Round-Trips, Tamper Detection and Randomness Sanity Checks
The scariest crypto bugs do not crash — they compute wrongly in silence: decryption returns garbage without complaint, or tampered ciphertext sails through. This tutorial writes assertion-only property tests for AES-GCM encryption — round-trip consistency, detection of any single-bit flip, different ciphertexts for the same plaintext, guaranteed failure under a wrong key — and explains why properties suit crypto code better than examples.
PythonProperty TestingAES-GCMTesting
Toy Experiment: Stitching X25519 and ML-KEM into a Hybrid Key Exchange with oqs-python
The hybrid idea is to let a classical algorithm and a post-quantum algorithm each contribute half of the secret and combine the halves into one key — if either half falls, the other still holds. This tutorial builds a runnable teaching version with liboqs-python's KEM interface and cryptography's X25519, and explains why the combiner must be more than plain concatenation.
PythonliboqsML-KEMHybrid Key Exchange
Password Storage in Practice: Storing Passwords Correctly with hashlib.scrypt and pbkdf2_hmac
User passwords must never be stored in plaintext, nor with a single SHA-256 — ordinary hashes are fast in exactly the way offline crackers want. This tutorial explains how password hashing fundamentally differs from ordinary hashing, and builds a complete salted, parameterized, verifiable storage format with hashlib.scrypt and hashlib.pbkdf2_hmac.
PythonscryptPBKDF2Password Hashing
Randomness Discipline: Why Keys Must Come from secrets, Never from random
The random module's Mersenne Twister is a predictable pseudorandom generator; keys, tokens and verification codes produced with it are effectively public. This tutorial explains how secrets, os.urandom and SystemRandom divide the work, with correct patterns for tokens, codes and generated passwords.
PythonsecretsRandomnessSecure Coding
X25519 Key Exchange with cryptography: From Shared Secret to Session Key
The core idea of Diffie-Hellman is that two parties derive the same secret over a public channel. This tutorial performs a complete elliptic-curve key exchange with the cryptography library's X25519 interface, then processes the raw shared secret into a usable session key with HKDF, and explains the checks you must not skip.
PythonX25519HKDFcryptography