Commit 8925ddee authored by Oleg Korshul's avatar Oleg Korshul

big integer from buffer bug

parent 84824631
......@@ -55,18 +55,10 @@ public:
for (int i = 0; i < size; i++)
{
int val = 0;
char _c = data[i];
if (_c >= '0' && _c <= '9')
val = _c - '0';
else if (_c >= 'A' && _c <= 'F')
val = 10 + _c - 'A';
else if (_c >= 'a' && _c <= 'f')
val = 10 + _c - 'a';
CBigInteger tmp(val);
CBigInteger tmp((int)data[i]);
for (int j = size - 1 - i; j > 0; --j)
tmp *= 10;
tmp *= 256;
*this += tmp;
}
......
......@@ -39,6 +39,10 @@ void main(void)
CBigInteger val3 = int1 * int2;
CBigInteger int3("66A1F302407647974D18D489855371B5", 16);
unsigned char buffer[16] = { 0x66, 0xA1, 0xF3, 0x02, 0x40, 0x76, 0x47, 0x97, 0x4D, 0x18, 0xD4, 0x89, 0x85, 0x53, 0x71, 0xB5 };
CBigInteger val4(buffer, 16);
std::string sValue = int3.ToString();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment