mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
crypto/edwards25519: faster point decompression
Make recovery of the x-coordinate slightly faster. See https://mailarchive.ietf.org/arch/msg/cfrg/qlKpMBqxXZYmDpXXIx6LO3Oznv4/ for details.
This commit is contained in:
parent
4266795743
commit
3abe464b06
@ -34,8 +34,7 @@ pub const Edwards25519 = struct {
|
||||
var v = u.mul(Fe.edwards25519d);
|
||||
u = u.sub(z);
|
||||
v = v.add(z);
|
||||
const v3 = v.sq().mul(v);
|
||||
var x = v3.sq().mul(v).mul(u).pow2523().mul(v3).mul(u);
|
||||
var x = u.mul(v).pow2523().mul(u);
|
||||
const vxx = x.sq().mul(v);
|
||||
const has_m_root = vxx.sub(u).isZero();
|
||||
const has_p_root = vxx.add(u).isZero();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user