From 74f0a18f312a8bd3b919cfcee193b2bb8bc91936 Mon Sep 17 00:00:00 2001 From: Alex Vlasov Date: Thu, 30 May 2019 16:13:01 +0300 Subject: [PATCH] cleaner NAF form --- src/bn256/mod.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/bn256/mod.rs b/src/bn256/mod.rs index b5688ab..10f1a91 100644 --- a/src/bn256/mod.rs +++ b/src/bn256/mod.rs @@ -29,10 +29,16 @@ pub struct Bn256; pub const BN_U: u64 = 4965661367192848881; // // 6U+2 for in NAF form -pub const SIX_U_PLUS_2_NAF : [i8; 65] = [0, 0, 0, 1, 0, 1, 0, -1, 0, 0, 1, -1, 0, 0, 1, 0, - 0, 1, 1, 0, -1, 0, 0, 1, 0, -1, 0, 0, 0, 0, 1, 1, - 1, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 1, - 1, 0, 0, -1, 0, 0, 0, 1, 1, 0, -1, 0, 0, 1, 0, 1, 1]; +pub const SIX_U_PLUS_2_NAF : [i8; 65] = [ + 0, 0, 0, 1, 0, 1, 0, -1, + 0, 0, 1, -1, 0, 0, 1, 0, + 0, 1, 1, 0, -1, 0, 0, 1, + 0, -1, 0, 0, 0, 0, 1, 1, + 1, 0, 0, -1, 0, 0, 1, 0, + 0, 0, 0, 0, -1, 0, 0, 1, + 1, 0, 0, -1, 0, 0, 0, 1, + 1, 0, -1, 0, 0, 1, 0, 1, + 1]; impl ScalarEngine for Bn256 { @@ -76,7 +82,6 @@ impl Engine for Bn256 { c1.c1.mul_assign(&p.x); // Sparse multiplication in Fq12 - f.mul_by_034(&c0, &c1, &coeffs.2); }