MCPcopy Create free account
hub / github.com/HyperDbg/HyperDbg / HexToInt

Function HexToInt

hyperdbg/script-engine/code/common.c:1458–1483  ·  view source on GitHub ↗

* @brief Converts an hexadecimal string to integer * * @param str the hexadecimal string to convert * @return unsigned long long */

Source from the content-addressed store, hash-verified

1456 * @return unsigned long long
1457 */
1458unsigned long long
1459HexToInt(char * str)
1460{
1461 CHAR Temp;
1462 SIZE_T Len = strlen(str);
1463 unsigned long long Acc = 0;
1464 for (int i = 0; i < Len; i++)
1465 {
1466 Acc <<= 4;
1467 if (str[i] >= '0' && str[i] <= '9')
1468 {
1469 Temp = str[i] - '0';
1470 }
1471 else if (str[i] >= 'a' && str[i] <= 'f')
1472 {
1473 Temp = str[i] - 'a' + 10;
1474 }
1475 else
1476 {
1477 Temp = str[i] - 'A' + 10;
1478 }
1479 Acc += Temp;
1480 }
1481
1482 return Acc;
1483}
1484
1485/**
1486 * @brief Converts an octal string to integer

Callers 1

ToSymbolFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected