Since no one else has chimed in on this with anything useful, I'll take up the gauntlet.
crypt() isn't a full system for encrypting and
decrypting data. It is a one way 'hash' used for encrypting passwords. The old system for unixish password protection used crypt().
The salt is a two character string that is "blended"
into to given password when hashing to help confuse the reversing of hashes back to passwords. The stored password
is of the form: SSHHHHHHHHHHH. When you are given a password and you want to check it against the stored hash, you simply do:
sub passtest {
$passtotest=shift;
$crypted=shift;
return ( crypt($passtotest,$crypted) eq $crypted );
}
The crypt function will just take the first two characters off of it's second argument and thus use the same salt as the originally crypted password.
See perldoc -f crypt for more on this.
Just please don't think you can get data back out of crypt() =)
--
$you = new YOU;
honk() if $you->love(perl) |