As an assignment, I have to find a password of a user starting from the hash of that password (which was made using crypt). So, I'm trying to create a variable salt (2-letter string) which I then tend to use in the crypt function until the result matches the hash. However, when I try to make this variable salt, instead of two characters, I get 5/6 (even if I define the salt as an array of size 2). Does anyone know how this can be fixed? Difficult explanation, I know, but see code (and result) below.
char salt[2];
for (int i = 65; i < 91; i++)
{
salt[0] = i;
for (int j = 65; j < 91; j++)
{
salt[1] = j;
printf("%s\n", salt);
}
}
Outcome: AA �g AB �g AC �g AD �g AE �g AF �g ... ... ... ZW �g ZX �g ZY �g ZZ �g
Where do these extra characters (= �g) come from?
Thank you