ed25519: add 128-bit NAF path#27
Open
efagerho wants to merge 1 commit into
Open
Conversation
Add Scalar::non_adjacent_form_128 and use it in the serial and vector triple-base verifier paths for scalars known to fit in 128 bits. The helper computes only the HEEA-readable digit range instead of producing a full 256-entry NAF array for each scalar. Benchmark notes: - Ran this repository's Criterion benchmark program, benches/bench.rs, filtering to Single Verification, pinned to CPU 4 with 1s warmup, 2s measurement, and sample size 10. - local_verify_zebra estimate was 19.740 us, with 95% CI 19.686..19.789 us. - master measured 20.051 us, with 95% CI 19.938..20.134 us, so this branch was about 1.55% faster in that run.
zz-sol
reviewed
Jun 8, 2026
| } | ||
|
|
||
| /// Compute a width-\\(w\\) non-adjacent form for scalars known to fit in 128 bits. | ||
| pub(crate) fn non_adjacent_form_128(&self, w: usize) -> [i8; NAF_128_SIZE] { |
Contributor
There was a problem hiding this comment.
is it possible to merge this function with non_adjacent_form to avoid duplicated code? For example,
fn non_adjacent_form(&self, w: usize, bits: usize)with bits = 256 or 128?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Scalar::non_adjacent_form_128 and use it in the serial and vector triple-base verifier paths for scalars known to fit in 128 bits. The helper computes only the HEEA-readable digit range instead of producing a full 256-entry NAF array for each scalar.
Benchmark notes:
Ran this repository's Criterion benchmark program, benches/bench.rs, filtering to Single Verification, pinned to CPU 4 with 1s warmup, 2s measurement, and sample size 10.
local_verify_zebra estimate was 19.740 us, with 95% CI 19.686..19.789 us.
master measured 20.051 us, with 95% CI 19.938..20.134 us, so this branch was about 1.55% faster in that run.