![]() |
|
go ahead... be a heretic | |
PerlMonks |
Re: UNIX user authenticationby trantor (Chaplain) |
on Oct 31, 2001 at 19:33 UTC ( #122353=note: print w/replies, xml ) | Need Help?? |
If I understood your question well, you simply read the encrypted password back and use the first two characters as the salt for encrypting the password you've just read. Then you compare them, if they match, the password is correct. Bummer otherwise. Warning: the salt is there because it gives 4096 different ways to encrypt the same password, so it makes it lengthy to try a dictionary attack with pre-encrypted passwords. If (as it in your case) the salt is easily predictable, somebody might find it easier to try a dictionary attack on your encrypted password, for exampl. This of course if they know how you generate salts and if tehy manage to access your encrypted data. As a rule of thumb, it's much better to generate it from random numbers. Have a look at this thread, or try a Super Search for more information.
In Section
Seekers of Perl Wisdom
|
|