in reply to Perl and Apache Configuration Files
#!/usr/bin/perl -Tw use strict; @salt = ('a' .. 'z', 'A' .. 'Z', '0' .. '9', '.', '/'); my ($username, $password) = @ARGV; my $now = time; my ($pert1, $pert2) = unpack("C2", $username); my $salt = $salt[($now / 604800 + $pert1 + $pert2) % 64] . $salt[$now +% 64]; $password = crypt($password, $salt); print STDOUT "$username:$password\n"; exit 0;
The salt for encryption in this case is based upon the first two characters of the username and the current system time.
perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'
|
|---|