From: hpa Date: Mon, 24 Jan 2005 19:07:55 +0000 (+0000) Subject: Allow setting a custom salt X-Git-Tag: syslinux-3.11~109 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b05ac381604932345c7ddc61008db021b66749d9;p=platform%2Fupstream%2Fsyslinux.git Allow setting a custom salt --- diff --git a/sha1pass b/sha1pass index 10ec8b5..76193f1 100755 --- a/sha1pass +++ b/sha1pass @@ -23,7 +23,10 @@ sub random_bytes($) { return $v; } -$salt = MIME::Base64::encode(random_bytes(6), ''); -$pass = Digest::SHA1::sha1_base64($salt, $ARGV[0]); + +($pass, $salt) = @ARGV; + +$salt = $salt || MIME::Base64::encode(random_bytes(6), ''); +$pass = Digest::SHA1::sha1_base64($salt, $pass); print '$4$', $salt, '$', $pass, "\$\n";