intel / cryptography-primitives

Apache License 2.0
318 stars 86 forks source link

Is this a bug in examples/utils/bignum.cpp num2hex function? #54

Closed justalittlenoob closed 1 year ago

justalittlenoob commented 1 year ago

It seems that there is a bug in examples/utils/bignum.cpp num2hex function.
Consider the following situations.

const char* c1 = "0xd";
BigNumber bn1(c1);

string s;
bn1.num2hex(s);

const char* c2 = s.c_str(); // c2 is " 0x3f2d"
BigNumber bn2(c2);

bn1 != bn2; // bn1 is not equal to bn2, which is not reasonable.

If this is indeed a bug, I have fixed it in this PR #53

opervush commented 1 year ago

Hi Pengfei Zhao,

Thanks for your contribution! We made the necessary checks and merged your fix to our internal repo. The changes will available in the next release. Thank you!

opervush commented 1 year ago

I am closing the issue, the code will be available in the future releases