code wiki / (root) / nx_p256_scalar_mul_wnaf.nx

nx_p256_scalar_mul_wnaf.nx

buildroot/runtime/nx_p256_scalar_mul_wnaf.nx

4614 B110 linesdepth 8pulls 9 transitivereach 580 importersview sourcekind librarytopic p256
docsdependenciesstructsconstsfunctions

about

nx_p256_scalar_mul_wnaf.nx -- variable-base scalar mult via width-4 wNAF (signed non-adjacent form). For the ECDSA verify's u2*Q (Q varies -> no fixed-base comb). Fewer point additions than the plain binary double-and-add: ~256/(4+1) ~= 51 adds instead of ~128. Precomputes the odd multiples {1,3,5,7}*Q (+ their negatives), recodes the scalar to signed digits, one double + conditional signed add per step. Variable-time is safe for verify (public scalars). Proven bit-identical to p256_scalar_mul by nx_p256_wnaf_difftest over many random scalars. license_tier: ORIGINAL

dependencies 5 imports · 4 importers

nx_syscalls.nx nx_u256.nx nx_p256_field.nx nx_p256_point.nx nx_p256_point_add.nx nx_p256_scalar_mul_wnaf.nx nx_ecdsa_p256.nx nx_p256_ecverify_core_bench.nx nx_p256_wnaf_bench.nx nx_p256_wnaf_difftest.nx

imports: nx_syscalls.nxnx_u256.nxnx_p256_field.nxnx_p256_point.nxnx_p256_point_add.nx

imported by: nx_ecdsa_p256.nxnx_p256_ecverify_core_bench.nxnx_p256_wnaf_bench.nxnx_p256_wnaf_difftest.nx

structs

none

consts

none

functions

14func p256_point_neg(out: *P256Point, p: *P256Point) -> i64
24func p256_scalar_mul_wnaf(out: *P256Point, k_8: *i64, p: *P256Point) -> i64