-
Notifications
You must be signed in to change notification settings - Fork 245
Description
When I multiply the zero of G1 by an instance of Big, I expect the result to be the zero of G1. But sometimes, this is not the case.
More explicitly, I have an initialization phase like this:
G1 g;
Big zero = 0;
g = pfc.mult(g, zero); // To make sure that g is the zero of G1
Big b;
G1 res;
Then I run a snippet like this:
pfc.random(b);
res = pfc.mult(g, b);
if (res.g.iszero()){
cout << "result is zero" << endl;
}
and I expect that the "result is zero" string is printed, but it is not.
But when I use an integer instead of a random Big, like this:
res = pfc.mult(g, 123456);
if (res.g.iszero()){
cout << "result is zero" << endl;
}
the "result is zero" string is printed.
This makes me think that there is a threshold before which the multiplication works as expected, but not after that. The following snippet somehow confirms this guess:
for (int i = 0; i < 500; i++){
b = 2 * b;
res = pfc.mult(g, b);
if (!res.g.iszero()){
cout << i << endl;
}
}
and the output is this:
383
387
388
389
392
393
394
395
396
397
398
399
400
401
...
By the way, I'm using bls_pair.cpp
as the implementation of paring_3.h
.
Could anyone help with this?
Thanks in advance!