mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 08:27:04 +00:00
Previously only mulDoubleG (verification) used GLV endomorphism + wNAF-5. The generic mul() and mulG() still used the old 4-bit window with 256 doublings and full Jacobian addition. Now all three scalar multiplication functions use GLV to split scalars into ~128-bit halves. mul() (arbitrary point, used by pubKeyTweakMul/ECDH): - Was: 4-bit window, 256 doublings, 15-entry Jacobian table, ~60 full adds - Now: GLV split + wNAF-5, ~130 doublings, 2×8-entry Jacobian tables mulG() (generator point, used by pubkeyCreate and signSchnorr): - Was: 4-bit window, 256 doublings, precomputed affine table, ~60 mixed adds - Now: GLV split + wNAF-5, ~130 doublings, precomputed affine G + λ(G) tables Benchmark improvements: pubkeyCreate: 4,391 → 6,689 ops/s (52% faster, 12.5x → 7.7x) pubKeyTweakMul: 3,427 → 5,233 ops/s (53% faster, 8.6x → 6.5x) pubKeyTweakMulCompact:2,941 → 4,593 ops/s (56% faster, 8.7x → 5.6x) signSchnorr: 1,178 → 1,516 ops/s (29% faster, 23.1x → 17.3x) compressedPubKeyFor: 4,358 → 6,919 ops/s (59% faster, 12.3x → 7.1x) https://claude.ai/code/session_01BhU63WUe9AhikZxRdw3Lpg