How does HMAC differ from a plain hash and a digital signature, and why sign requests despite HTTPS?
Short answer
A plain hash can be computed by anyone, so it proves no origin; HMAC needs a shared secret; a digital signature signs with a private key and verifies with the public key. HTTPS only protects the transport; signing protects the message itself.
3 points to say:
- Don't roll your own
sha256(secret + message); use standard HMAC and a constant-time comparison. - Digital signatures give non-repudiation and suit many consumers (RS256/ES256 + JWKS); HMAC is very fast and fits 1–1 webhooks.
- TLS terminates at the proxy and does not stop replay; sign the raw body bytes, with a timestamp inside the signed part.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.