# ML-KEM (FIPS 203) is NIST's new post-quantum key exchange standard, replacing vulnerable algorithms like ECDH

**Date:** 2025-12-18  
**Tags:** Cryptography, Security, PostQuantum  
**URL:** https://kelexine.is-a.dev/til/ml-kem-post-quantum

---

TIL: ML-KEM (FIPS 203) is NIST's new post-quantum key exchange standard, replacing vulnerable algorithms like ECDH. It's based on the Module Learning With Errors (MLWE) problem - hard for both classical and quantum computers. Key sizes are larger (~1KB vs ~32 bytes) but operations are efficient.


```python
from pqcrypto.kem.kyber768 import generate_keypair, encapsulate, decapsulate

# Server generates keypair
public_key, secret_key = generate_keypair()

# Client encapsulates shared secret
ciphertext, shared_secret_client = encapsulate(public_key)

# Server decapsulates
shared_secret_server = decapsulate(secret_key, ciphertext)
# Both have same shared_secret for symmetric encryption
```




---

*This content is available at [kelexine.is-a.dev/til/ml-kem-post-quantum](https://kelexine.is-a.dev/til/ml-kem-post-quantum)*
