11 if ( open(RANDOM
, '<', '/dev/random') ||
12 open(RANDOM
, '<', '/dev/urandom') ) {
15 # No real RNG available...
18 for ( $i = 0 ; $i < $n ; $i++ ) {
19 $v .= ord(int(rand() * 256));
27 ($pass, $salt) = @ARGV;
29 $salt = $salt || MIME
::Base64
::encode
(random_bytes
(6), '');
30 $pass = Digest
::SHA1
::sha1_base64
($salt, $pass);
32 print '$4$', $salt, '$', $pass, "\$\n";