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

feat: constant time Equal with tests and benchmarks #144

Merged
merged 4 commits into from
Feb 4, 2022

Conversation

Tabaie
Copy link
Contributor

@Tabaie Tabaie commented Feb 2, 2022

Slightly faster than Equals on small moduli, up to %50 slower on big ones
May be useful in algorithms advertised as c-time like sswu hash

@Tabaie Tabaie requested a review from gbotrel February 2, 2022 18:03
@gbotrel
Copy link
Collaborator

gbotrel commented Feb 3, 2022

lgtm 👍
But, given that perf is so close, I'ld avoid surcharging the Element API; replace the old "Equal" with the new one (and no need to decompose in 2 methods with Diff / EqualCT).

@yelhousni I did a quick search and I don't think equal is perf critical anywhere in the pairing or msm, is it? Impact of this PR --> for BW6 curves (not for the others) the equal when field elements are different becomes twice slower (we're talking 2ns to 4ns... )

@Tabaie Tabaie requested a review from yelhousni February 3, 2022 17:08
@yelhousni
Copy link
Collaborator

I think it's fine to replace the old Equal with the new c-time one. We would rather get a c-time hash-to-curve than a slower pairing check on BW6 curves (which occurs only when there is a problem).

@Tabaie Tabaie merged commit 643ecb3 into develop Feb 4, 2022
@Tabaie Tabaie deleted the constant-time-equals branch February 4, 2022 16:52
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.

3 participants