aboutsummaryrefslogtreecommitdiffstats
path: root/sha1pass
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2006-10-26 14:39:26 -0700
committerH. Peter Anvin <hpa@zytor.com>2006-10-26 14:39:26 -0700
commit02131f189f079ff3cbf0ad2cb6078ba28871b62f (patch)
tree29be603dff29c92ad99c93a743ee4c80ee2b3fc6 /sha1pass
parent0a9bdf66956cff22f334c4f9db4e70c8fc5364ab (diff)
downloadsyslinux.git-02131f189f079ff3cbf0ad2cb6078ba28871b62f.tar.gz
syslinux.git-02131f189f079ff3cbf0ad2cb6078ba28871b62f.tar.xz
syslinux.git-02131f189f079ff3cbf0ad2cb6078ba28871b62f.zip
sha1pass: allow the user to specify an empty salt
Diffstat (limited to 'sha1pass')
-rwxr-xr-xsha1pass4
1 files changed, 3 insertions, 1 deletions
diff --git a/sha1pass b/sha1pass
index 26ea76bc..3be2dbc1 100755
--- a/sha1pass
+++ b/sha1pass
@@ -26,7 +26,9 @@ sub random_bytes($) {
($pass, $salt) = @ARGV;
-$salt = $salt || MIME::Base64::encode(random_bytes(6), '');
+unless (defined($salt)) {
+ $salt = MIME::Base64::encode(random_bytes(6), '');
+}
$pass = Digest::SHA1::sha1_base64($salt, $pass);
print '$4$', $salt, '$', $pass, "\$\n";