>Perhaps you need to rewrite mkSalt() so it supports MD5 salts as well, if >that's what your system's crypt() expects (?).
Talking of which, I've managed to find a subroutine I wrote that does exactly this... #---------------------------------------------------------------------------- # generate_salt() # generates a random "salt" for use with crypt(3), which Perl's crypt() # is based on. # # Notes # The DES based algorithm uses a salt of 2 characters drawn from the range # [a-zA-Z0-9./]. MD5 uses a variable length salt: '$1$' (the signature # that tells crypt(3) the caller wants MD5 encryption rather than DES) # followed by 0-8 characters of the same range as the DES salt, followed # optionally by '$'. # # /\A[a-zA-Z0-9.\/]{2}\z/ // regex for DES salt # /\A\$1\$[a-zA-Z0-9.\/]{0,8}\$?\z/ // regex for MD5 salt # # Returns # a "salt" string appropriate for crypt(3) - may be DES or MD5 salt #---------------------------------------------------------------------------- sub generate_salt { my $algo = choose_crypt_algo($PREFERRED_CRYPT_ALGO); my @salt_chars = ('a'..'z', 'A'..'Z', 0..9, '.', '/'); my ($salt, $salt_length); srand; ### set random number seed for CORE::rand if ( $algo & $DES_CRYPT ) { ### chosen crypt algorithm is DES $salt = ''; $salt_length = 2; } else { ### chosen crypt algorithm is MD5 $salt = '$1$'; # MD5 salt prefix $salt_length = int rand 9; # random integer from 0 to 8 inclusive } while ($salt_length--) { ### randomly generate the salt my $idx = int rand @salt_chars; $salt .= $salt_chars[$idx]; } return $salt; } hth, Mark -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html