1 #!/bin/bash
2
3 saltlen=8
4
5 salt="$(cat /dev/urandom | head -c $saltlen)"
6 pwsalt=$1$salt
7
8 pwhash="$(head -c -1 << EOF | openssl dgst -sha1 -binary
9 $pwsalt
10 EOF
11 )"
12
13 ssha="$(head -c -1 << EOF | base64
14 $pwhash$salt
15 EOF
16 )"
17
18 ssha="{SSHA}$ssha"
19 echo $ssha
20
21