Look at this very basic c program:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <crypt.h>
int main (int argc, char *argv[])
{
char pid[16];
int id;
for (id = 0; id < 100; id++)
{
snprintf(pid, sizeof(pid), "%i", id);
printf("%s %s\n",pid, crypt(pid, "$1$awesome"));
}
}
Here is the output on linux system:
0 $1$awesome$cVjo4Ue9HeJs7sStMTm6v.
1 $1$awesome$6.658tD5uVqwQJ6/S8Mc71
2 $1$awesome$bKavcHTWRGnlTgP.zTZhO.
3 $1$awesome$ZlBH.fgxGrfw/naq38hyv.
4 $1$awesome$aQCliN7gPud1PC07Vri.y1
5 $1$awesome$EewcRVU39I/n0uMGaDxCN0
6 $1$awesome$fKMRDZaa5wra4G8xy9.m0/
7 $1$awesome$AqJ0SmXImg.xcUg/Yh/ov.
8 $1$awesome$bT3Wq9QORw1dnNZFZmVBk.
9 $1$awesome$4uM8mfZGdj2zeZ/CP/GSz1
10 $1$awesome$Gsa/ilcFg1LRl2dqNhgXg0
I do not understand why the salt is visible on the output. I have tried to compile the same program on Mac OS X and I did not see the salt in the hash. Isn't it a security hole? We should not see the salt in clear in the hash ?
Thanks