From: Paul Hänsch Date: Mon, 2 Aug 2021 10:23:04 +0000 (+0200) Subject: improved gonzo mac if openssl is unavailable X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=38702dbb48387609925572f2269b222f87eb9c1a;p=cgilite improved gonzo mac if openssl is unavailable --- diff --git a/session.sh b/session.sh index 8929ab3..ca931fa 100755 --- a/session.sh +++ b/session.sh @@ -16,8 +16,16 @@ fi if which openssl >/dev/null; then session_mac(){ { [ $# -gt 0 ] && printf %s "$*" || cat; } | openssl dgst -sha1 -hmac "$(server_key)" -binary |slopecode; } else - # sham hmac if openssl is unavailable - session_mac(){ { [ $# -gt 0 ] && printf %s "$*" || cat; server_key; } | sha256sum |cut -d\ -f1; } + # Gonzo MAC if openssl is unavailable + session_mac(){ + { server_key | dd status=none bs=256 count=1 skip=1 + { server_key | dd status=none bs=256 count=1 + [ $# -gt 0 ] && printf %s "$*" || cat + } \ + | sha256sum -; + } \ + | sha256sum | cut -d\ -f1 + } fi server_key(){