Open ry4ng opened 7 years ago
this might help you
` void InfInt::addHexString(const char* s) { if(s == NULL) return;
size_t hex_len = strlen(s);
InfInt temp(0);
InfInt base(0);
for(size_t i = 0; i < hex_len; i++)
{
char ch = s[hex_len - i - 1];
unsigned char dec = 0;
//ascii conversion of each character
if(ch >= 48 && ch <= 57) dec = ch - 48;
else if(ch >= 65 && ch <= 70) dec = ch - 55;
else if(ch >= 97 && ch <= 102) dec = ch - 87;
size_t exp = i;
base = 16;
temp = dec;
while(exp != 0)
{
if((exp & 1) == 1)
temp *= base;
exp >>= 1;
base *= base;
}
(*this) += temp;
}
} `
i tested it with 3581bit number and it's working EDIT: rewritten to a method
7649f43c17e43e08446ce5b3119f905acc4e380233e8e96f0468f12aa2b249fb
Allow the incrementation of huge hex values?