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

Add a marker trait for equality testing #131

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

AaronFeickert
Copy link
Contributor

@AaronFeickert AaronFeickert commented Jul 5, 2024

It's a (fairly?) common design pattern to have certain types use ConstantTimeEq to implement Eq (via PartialEq) for improved safety. For example, curve2519-dalek does this for its Scalar and RistrettoPoint types by coercing the resulting Choice into a bool.

It would be useful to be able to signal to implementers if a type does this. Otherwise, for some applications the only way to guarantee that a type supporting ConstantTimeEq uses it for all equality testing is to check this yourself, and it makes it tricky if you want to do this to build more complex traits.

This PR adds a new EqIsConstantTimeEq marker trait. The intent is to have types that follow this design pattern use it as a signal to implementers.

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.

None yet

1 participant