Skip to content

Instantly share code, notes, and snippets.

@0x696c4f
Created January 2, 2019 22:27
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save 0x696c4f/38badb838a8f2f56d402093b5dbf34aa to your computer and use it in GitHub Desktop.
Save 0x696c4f/38badb838a8f2f56d402093b5dbf34aa to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]
then
echo "Usage YubikeyHMAC:"
echo " Path of KeepassXC Database with Argon2 (KDBX 4)"
echo " Secret key"
echo " Keyfile name to write to"
echo " Example ./YubikeyHMAC.sh Passwords.kdbx \"ed163d2e495acb652e5d2ecb103429064dd97c6a\" Keyfile"
exit 0
fi
xxd -p -c 33 -s 0xc5 -l 32 $1 | xxd -r -p | openssl dgst -sha1 -hmac "$(echo -n $2 | xxd -r -p)" | cut -c 10- | xxd -r -p > $3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment