Your comments

I found a way using node.js and the script you referred to:

SHA_256_JS=/path/to/script/sha256.js
if ! grep -q 'console.log' ${SHA_256_JS} ; then
  echo "console.log(hex_hmac_sha256(process.argv[2], process.argv[3]));" >> ${SHA_256_JS}
fi
node ${SHA_256_JS} ${MEDIA_PASSWD} d0809793df2c3be1a77a229781cfe1cdb1a2a > /opt/ubooquity/webadmin.cred
chown $UBOOQUITY_USER:$UBOOQUITY_USER /opt/ubooquity/webadmin.cred

I'm trying to do this as well. I looked at the Stackoverflow thread, but it does not say anything about a salt, neither could I find anything about this elsewhere. I tried this:

echo -n "value" | openssl dgst -sha256 -hmac "key"

but it gives the wrong hash. How should I compute the hash in bash using the specified salt?