What is an HMAC and How Does It Work?
HMAC is widely used across modern web development to sign API requests, authenticate Webhooks, and secure API endpoints. Unlike a standard hash (such as SHA-256), which only verifies that data has not been altered, an HMAC proves that the sender knows the shared secret key.
When an API endpoint (such as GitHub Webhooks or Stripe) sends data to your server, it calculates an HMAC of the payload using your shared webhook secret and sends it in a header. Your server recalculates the HMAC locally to verify that the message is authentic and untampered.