You are passing entire strings to atoi:
"3255859300350" // First loop iteration
"255859300350" // Second loop iteration
"55859300350"
"5859300350"
// And so on...
One solution is to use temporary buffer in loop:
char temp [2] = { 0, 0 }; // Second element is for NUL character
temp[0] = hashString[i]; // Copy first char
hashStringInput[i] = atoi(temp);
Also, don't use +1
with your strlen
, you don't want to convert the NUL character.