Improved HMAC generation