From 38702dbb48387609925572f2269b222f87eb9c1a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Mon, 2 Aug 2021 12:23:04 +0200 Subject: [PATCH] improved gonzo mac if openssl is unavailable --- session.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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(){ -- 2.39.2