fix reference before assignment when using hmac, add test case for hmac algorithm