Tạo một HMAC cho một thông điệp và khóa secret bằng SHA-1, SHA-256, SHA-384 hoặc SHA-512, trong trình duyệt của bạn.
Cách dùng HMAC
Chọn một thuật toán băm.
Nhập khóa secret và thông điệp của bạn.
Sao chép HMAC, được hiển thị dưới dạng hex digest.
An HMAC generator that signs a message with a secret key using SHA-1, SHA-256, SHA-384 or SHA-512, and shows the result as a hex digest. Pick an algorithm, enter the key and the message, and copy the signature.
HMAC stands for hash-based message authentication code. It is a keyed hash: combining a secret key with the message proves two things at once, that the message was created by someone who holds the key, and that it has not been altered in transit.
The difference from a plain hash is the key. Anyone can compute a SHA-256 of a message, but only someone with the shared secret can produce the correct HMAC, which is what turns a checksum into proof of authenticity.
That is why it is everywhere in web infrastructure. Webhooks from services like Stripe, GitHub and Slack sign each request with an HMAC so your server can verify the call really came from them, and many APIs sign requests the same way.
SHA-256 is the common default; SHA-384 and SHA-512 are stronger, while SHA-1 is legacy and best avoided for new systems.
It runs locally with the Web Crypto API, so your key and message are never uploaded, which is important since the key is a secret.
Câu hỏi thường gặp
Một hàm băm có khóa chứng minh một thông điệp được tạo bởi người nắm khóa secret và không bị thay đổi. Nó được dùng rộng rãi để ký yêu cầu API và webhook.
Không. HMAC được tính trong trình duyệt của bạn bằng Web Crypto API, nên khóa và thông điệp không bao giờ rời khỏi thiết bị.
SHA-256 là mặc định phổ biến. SHA-384 và SHA-512 mạnh hơn; SHA-1 là cũ và nên tránh cho hệ thống mới.
Nhúng công cụ này
Thêm công cụ này vào trang web của riêng bạn. Sao chép đoạn mã bên dưới; nó tự động cập nhật.
<iframe src="https://monu.tools/embed/vi/hmac-generator" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>Công cụ liên quan
Mã hóa văn bản sang Base64 hoặc giải mã Base64 về văn bản. An toàn UTF-8 với tự động nhận diện hướng.
Mã hóa và giải mã percent cho URL và thành phần URL, an toàn UTF-8.
Giải mã JSON Web Token để kiểm tra header và payload của nó, với thời gian hết hạn và thời gian phát hành dễ đọc. Chạy hoàn toàn trong trình duyệt của bạn; token không bao giờ được tải lên.
Tạo mã băm SHA-1, SHA-256, SHA-384 và SHA-512 cho bất kỳ văn bản nào, ngay trong trình duyệt của bạn.