-
Notifications
You must be signed in to change notification settings - Fork 1.6k
hoist HKDF into rust for even more speed #12995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
(you've got failing tests) |
This PR was done via zed+claude sonnet 4 (with some cleanup and additions) using the following prompt: Please implement HKDF in rust. You can follow the example in hmac.rs to see similar structure, but implement the general HKDF algorithm as seen in hkdf.py
Co-authored-by: Alex Gaynor <[email protected]>
src/rust/src/backend/kdf.rs
Outdated
use pyo3::prelude::PyAnyMethods; | ||
use pyo3::types::PyBytesMethods; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use pyo3::prelude::PyAnyMethods; | |
use pyo3::types::PyBytesMethods; | |
use pyo3::types::{PyAnyMethods, PyBytesMethods}; |
src/rust/src/backend/kdf.rs
Outdated
if actual_bytes.len() != expected_bytes.len() | ||
|| !openssl::memcmp::eq(actual_bytes, expected_bytes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a utility function for this.
src/rust/src/backend/kdf.rs
Outdated
if actual_bytes.len() != expected_bytes.len() | ||
|| !openssl::memcmp::eq(actual_bytes, expected_bytes) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
This PR was done via zed+claude sonnet 4 (with some cleanup and additions) using the following prompt:
Please implement HKDF in rust. You can follow the example in hmac.rs to see similar structure, but implement the general HKDF algorithm as seen in hkdf.py