cleaner NAF form

This commit is contained in:
Alex Vlasov 2019-05-30 16:13:01 +03:00
parent d2c8b93fe9
commit 74f0a18f31

@ -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);
}