Skip to content

Instantly share code, notes, and snippets.

@nhtzr
Last active February 16, 2020 02:10
Show Gist options
  • Save nhtzr/ec6f610ceb02df6fb5b0211adf497fba to your computer and use it in GitHub Desktop.
Save nhtzr/ec6f610ceb02df6fb5b0211adf497fba to your computer and use it in GitHub Desktop.
#!/bin/sh
declare SALT # One time pad
if [ "${1+x}" = x ]; then
SALT="$1"
else
# 64byte = 512bit
SALT="$(head -c64 /dev/random)"
fi
( IFS=; stty -echo; read -r line; printf '%s' "$line" "$SALT"
) 2>/dev/null |
sha512sum | awk '{print $1}' | xxd -r -p |
base91 -w0
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment