in reply to encryption confusion
It is a bug in your code. If you don't pass 3 arguments to the function then you generate a salt based on the first 2 chars in $0 -> which is the script name. If the names of the scripts are different the salts will be different and thus the cryptstring will be different.
Something like this will suffice:
sub CryptPasswd { my ($username, $passwd, $salt) = @_; $salt ||= 'anystring'; # only first 2 chars will be used return crypt ($passwd, $salt); }
Note that crypt will ignore all but the first 2 chars of the salt. The two char salt is there to increase the permutations and make it harder to brute force things. Pick a secret two char string and stick with it.
cheers
tachyon
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: encryption confusion
by gaal (Parson) on Aug 20, 2004 at 06:55 UTC | |
by tachyon (Chancellor) on Aug 20, 2004 at 08:23 UTC | |
by bgreenlee (Friar) on Aug 20, 2004 at 08:50 UTC | |
by bgreenlee (Friar) on Aug 20, 2004 at 08:02 UTC | |
by gaal (Parson) on Aug 20, 2004 at 20:52 UTC |