crypto.edwards25519: optimize rejectLowOrder #30650

Merged
jedisct1 merged 1 commit from jedisct1/zig:ed25519rej into master 2026-01-02 23:37:14 +01:00
Member

Reject low-order points by checking projective coordinates directly instead of using affine coordinates.

Equivalent, but saves CPU cycles (~254 field multiplications total before, 3 field multiplications after).

Reject low-order points by checking projective coordinates directly instead of using affine coordinates. Equivalent, but saves CPU cycles (~254 field multiplications total before, 3 field multiplications after).
crypto.edwards25519: optimize rejectLowOrder
All checks were successful
ci / riscv64-linux-debug (pull_request) Has been skipped
ci / riscv64-linux-release (pull_request) Has been skipped
ci / x86_64-freebsd-release (pull_request) Successful in 46m58s
ci / x86_64-windows-release (pull_request) Successful in 47m57s
ci / x86_64-windows-debug (pull_request) Successful in 49m23s
ci / x86_64-freebsd-debug (pull_request) Successful in 55m54s
ci / aarch64-macos-release (pull_request) Successful in 1h6m6s
ci / x86_64-linux-debug (pull_request) Successful in 1h12m35s
ci / aarch64-linux-release (pull_request) Successful in 1h31m26s
ci / x86_64-linux-debug-llvm (pull_request) Successful in 1h40m3s
ci / aarch64-macos-debug (pull_request) Successful in 1h58m15s
ci / aarch64-linux-debug (pull_request) Successful in 2h26m40s
ci / s390x-linux-release (pull_request) Successful in 1h56m28s
ci / s390x-linux-debug (pull_request) Successful in 2h40m2s
ci / x86_64-linux-release (pull_request) Successful in 2h46m19s
ci / loongarch64-linux-release (pull_request) Successful in 2h16m7s
ci / loongarch64-linux-debug (pull_request) Successful in 3h28m56s
1baa127c65
Reject low-order points by checking projective coordinates directly
instead of using affine coordinates.

Equivalent, but saves CPU cycles (~254 field multiplications total
before, 3 field multiplications after).
Contributor

Another thing I suggest, that I'm not sure the stdlib needs but still, is an API for rejecting low-order (order <= 8) points from a known affine point. Very useful for rejecting low-order points (like A,R in EdDSA verify) when it was just decoded from the wire, so you know it's affine. It's only 4 comparisons: example impl.

Another thing I suggest, that I'm not sure the stdlib needs but still, is an API for rejecting low-order (order <= 8) points from a known affine point. Very useful for rejecting low-order points (like A,R in EdDSA verify) when it was just decoded from the wire, so you know it's affine. It's only 4 comparisons: [example impl](https://github.com/Syndica/sig/blob/a1f9f3223c3e192d1c431eccd3fbfb507c7abe1d/src/crypto/ed25519/lib.zig#L156).
Author
Member

@sinon why not, that can be useful!

@sinon why not, that can be useful!
jedisct1 merged commit 1bf29757d9 into master 2026-01-02 23:37:14 +01:00
jedisct1 deleted branch ed25519rej 2026-01-02 23:37:16 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ziglang/zig!30650
No description provided.