Nov 09 2006

linux and its crypt() function

Tag: c, kernel, linuxdenis @ 4:24 pm

want to use that handy crypt function in your software? after wasting some time, i discovered that one must prefix the salts with “$1$”. So it goes like this:
strcpy(new_salt, "$1$");
strcat(new_salt, salt);
hashed_password = crypt(passwd, new_salt);

hope this can help someone.