When checking the manual entry for man crypt
, I read:
The returned value points to the encrypted password, a series of 13 printable ASCII characters (the first two characters represent the salt itself).
I made a dummy function to test 'crypt()'
, and, indeed, that's precisely the behaviour I see:
pass = 'abcdef', salt = 'bB' --> hashed = 'bB3chWwMx2m9A'
pass = 'abcdefgh', salt = 'bB' --> hashed = 'bBOdphLIbu4wI'
The way I see it, I read the hashed string from a file, I get the first two char, and I already have my 'salt' ready. I only need to crypt my guesses once.
So, I was wondering: if you can "deduce" the value of 'salt' from the hashed string... What's the purpose of it existing anyway? (or is it because while using other hashing methods, such as "SHA-512", it does make a difference?)