Skip to content

feat: constant time Equal with tests and benchmarks#144

Merged
Tabaie merged 4 commits intodevelopfrom
constant-time-equals
Feb 4, 2022
Merged

feat: constant time Equal with tests and benchmarks#144
Tabaie merged 4 commits intodevelopfrom
constant-time-equals

Conversation

@Tabaie
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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