Works on Mac OS X
This commit is contained in:
parent
d739b3d893
commit
b5922d54d3
1 changed files with 18 additions and 8 deletions
26
ypassword
26
ypassword
|
@ -38,17 +38,27 @@ else
|
||||||
read password
|
read password
|
||||||
stty $oldmodes
|
stty $oldmodes
|
||||||
|
|
||||||
case $hashalgo in
|
if [[ -x =shasum ]]; then
|
||||||
sha1) hashcmd="sha1sum" ;;
|
case $hashalgo in
|
||||||
sha256) hashcmd="sha512sum" ;;
|
sha1) hashcmd="shasum -a 1" ;;
|
||||||
sha512) hashcmd="sha512sum" ;;
|
sha256) hashcmd="shasum -a 256" ;;
|
||||||
*) print -- "Unknown algorithm: $hashalgo" >&2
|
sha512) hashcmd="shasum -a 512" ;;
|
||||||
exit 1
|
*) print -- "Unknown algorithm: $hashalgo" >&2
|
||||||
esac
|
exit 1
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
case $hashalgo in
|
||||||
|
sha1) hashcmd="sha1sum" ;;
|
||||||
|
sha256) hashcmd="sha256sum" ;;
|
||||||
|
sha512) hashcmd="sha512sum" ;;
|
||||||
|
*) print -- "Unknown algorithm: $hashalgo" >&2
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $base64 = "b64" ]]; then
|
if [[ $base64 = "b64" ]]; then
|
||||||
# make a hex2b64
|
# make a hex2b64
|
||||||
hashcmd="$hashcmd | cut -f1 -d\\ | xxd -r -p | base64 --wrap=88"
|
hashcmd="$hashcmd | cut -f1 -d\\ | xxd -r -p | base64"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmd='echo -n "'$password$num$domainName'" | '$hashcmd' | awk "{print substr(\$1,1,'$longueur');}"'
|
cmd='echo -n "'$password$num$domainName'" | '$hashcmd' | awk "{print substr(\$1,1,'$longueur');}"'
|
||||||
|
|
Loading…
Reference in a new issue