Skip to content
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

Implement constant-time hash ordering #420

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AaronFeickert
Copy link
Contributor

This PR implements constant-time ordering (and partial ordering) for Hash, but does so differently than #267 and #370.

It uses subtle internally to lexicographically compare corresponding bytes, being careful not to short circuit. This simplifies the logic considerably.

Note that it does not use subtle to implement PartialEq; this functionality exists in #419 since it seemed better scoped for a separate PR. However, if #419 is implemented, it will be possible to implement ConstantTimeGreater and ConstantTimeLess due to the latter requiring a ConstantTimeEq trait bound included in that PR.

@AaronFeickert
Copy link
Contributor Author

Marking as draft for now, since #419 would add subtle support via an optional feature that would presumably be used here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant