Skip to content

Conversation

@alex
Copy link
Member

@alex alex commented Jan 29, 2026

No description provided.

claude and others added 7 commits January 28, 2026 23:33
Move the HPKE (Hybrid Public Key Encryption) implementation from pure
Python to Rust for improved performance. The implementation follows
RFC 9180 and includes:

- KEM: DHKEM(X25519, HKDF-SHA256)
- KDF: HKDF-SHA256
- AEAD: AES-128-GCM
- Mode: Base mode only

The public API remains unchanged - KEM, KDF, AEAD enums and Suite class
are now backed by Rust via PyO3.

https://claude.ai/code/session_01W43m9LudrvqkHKr4BrMa7c
- Use proper Rust enums with #[pyclass] for KEM, KDF, and AEAD types
- Accept Python ABCs for keys using pyo3::PyAny and Python APIs
- Remove unnecessary internal helper methods from x25519.rs
- Simplify type stub file by removing unnecessary value properties
- Update tests to work with pyo3's native type checking error messages

https://claude.ai/code/session_01W43m9LudrvqkHKr4BrMa7c
- Organize algorithm constants into modules for easy extension
- Remove empty enum impl blocks and unnecessary __eq__/__hash__ from type stubs
- Reuse hkdf_extract from kdf.rs (made pub(crate))
- Reuse EvpCipherAead from aead.rs (made pub(crate))
- Use Python API for x25519 key generation and exchange operations
- Simplify code by removing duplicated HKDF and AEAD implementations

https://claude.ai/code/session_01W43m9LudrvqkHKr4BrMa7c
- Add LazyPyImport entries for X25519_PRIVATE_KEY, X25519_PUBLIC_KEY,
  HKDF_EXPAND, and AESGCM to types.rs
- Replace manual HKDF expand implementation with Python HKDFExpand class
- Use Python AESGCM for encryption/decryption instead of EvpCipherAead
- Use LazyPyImport for X25519 key operations

https://claude.ai/code/session_01W43m9LudrvqkHKr4BrMa7c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants