miracl / core

MIRACL Core
Apache License 2.0
206 stars 68 forks source link

ECP::muln() bug? #35

Closed blynn closed 3 years ago

blynn commented 3 years ago

I may be using the API wrongly, but I think the 3 print statements in the following program should agree:

extern crate core;
use core::bls12381::ecp::ECP;
use core::bls12381::big::BIG;
use std::vec::Vec;

fn main() {
    let g1 = ECP::generator();
    let x = BIG::new_int(1);

    let mut ps = Vec::new();
    ps.push(g1.clone());

    let mut xs = Vec::new();
    xs.push(x.clone());

    println!("g1: {}", g1.tostring());
    println!("mul: {}", g1.mul(&x).tostring());
    println!("muln: {}", ECP::muln(1, &ps, &xs).tostring());
}

However, I got:

g1: (17F1D3A73197D7942695638C4FA9AC0FC3688C4F9774B905A14E3A3F171BAC586C55E83FF97A1AEFFB3AF00ADB22C6BB,08B3F481E3AAA0F1A09E30ED741D8AE4FCF5E095D5D00AF600DB18CB2C04B3EDD03CC744A2888AE40CAA232946C5E7E1)
mul: (17F1D3A73197D7942695638C4FA9AC0FC3688C4F9774B905A14E3A3F171BAC586C55E83FF97A1AEFFB3AF00ADB22C6BB,08B3F481E3AAA0F1A09E30ED741D8AE4FCF5E095D5D00AF600DB18CB2C04B3EDD03CC744A2888AE40CAA232946C5E7E1)
muln: (0572CBEA904D67468808C8EB50A9450C9721DB309128012543902D0AC358A62AE28F75BB8F1C7C42C39A8C5529BF0F4E,166A9D8CABC673A322FDA673779D8E3822BA3ECB8670E461F73BB9021D5FD76A4C56D9D4CD16BD1BBA86881979749D28)
mcarrickscott commented 3 years ago

Yes, that's a bug, now fixed..

blynn commented 3 years ago

Thanks!