해시/암호화
HMAC Generator
비밀 키로 텍스트나 파일의 HMAC(Hash-based Message Authentication Code)을 계산합니다 — MD5, SHA-1, SHA-256, SHA-384, SHA-512, SHA3-256, SHA3-512, RIPEMD-160 8개 알고리즘을 한 번에.
HMAC (Hash-based Message Authentication Code) is a hash computed together with a secret key, proving a message hasn't changed and was sent by someone who knows that key. Unlike a plain hash, an HMAC can't be forged without knowing the secret.
How to use it
- Enter text or a file and a secret key — the HMAC is computed instantly with eight algorithms at once (MD5, SHA-1, SHA-2, SHA3, RIPEMD-160).
- Copy the variant you need to verify a signature or compare against an expected value.
- The same input and key always produce the same HMAC — handy for checking against a signature received from another system.
Common uses
- Verifying a webhook signature from a payment service or API (most sign the payload with HMAC-SHA256).
- Generating a request signature for an API that requires HMAC authentication.
- Debugging a mismatched signature — checking the key, input encoding, and algorithm one at a time.
Things to keep in mind
HMAC protects against tampering and confirms the sender's authenticity, but it doesn't encrypt the message itself — the content stays readable.
A mismatched HMAC is most often caused by different data encoding (e.g. JSON field order) or a stray whitespace or line break, not by a bug in the algorithm itself.
자주 묻는 질문
HMAC과 일반 해시의 차이는 무엇인가요?
일반 해시는 키 없이 데이터의 지문만 계산하지만, HMAC은 비밀 키를 함께 사용해 데이터의 무결성뿐 아니라 인증(그 키를 아는 사람이 만들었는지)까지 증명합니다.
어떤 알고리즘과 키 길이를 선택해야 하나요?
HMAC-SHA-256 이상을 권장하며, 키는 해당 해시 함수의 블록 크기(예: SHA-256은 64바이트) 이상으로 무작위 생성하는 것이 안전합니다. MD5나 SHA-1 기반 HMAC은 새로운 용도에는 피하는 것이 좋습니다.
비밀 키는 서버로 전송되나요?
아니요. 입력한 키와 데이터는 브라우저 안에서만 처리되며 어디로도 업로드되지 않습니다.
HMAC을 일반 동등 연산자로 비교하면 안 되는 이유는 무엇인가요?
일반 문자열 비교는 첫 번째로 다른 부분에서 멈추기 때문에, 비교에 걸리는 시간이 공격자에게 앞부분 몇 글자를 올바르게 맞혔는지 알려줍니다(timing attack). PHP의 hash_equals 같은 상수 시간 비교 함수가 필요합니다.
동일한 키를 여러 용도에 재사용해도 되나요?
권장하지 않습니다. 같은 비밀 키를 웹훅 서명과 다른 용도에 함께 사용하면, 한 시스템이 침해당했을 때 다른 시스템도 함께 침해됩니다 — 각 용도마다 별도의 키를 생성하는 것이 좋습니다.