Optimize HMAC implementation