Skip to content

Issue in the multiplication of a Big instance and the zero of G1 (pairing_3.h) #133

@behzad-vahdani

Description

@behzad-vahdani

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions