hmac_test refactored a bit