HMACジェネレーター
ブラウザで直接HMAC-SHA256/384/512署名を生成。Web Crypto APIを使用し、秘密鍵がデバイスから離れることはありません。100%クライアントサイド。
100%クライアントサイド — データがデバイスから離れることはありません
Note: All HMAC and JWT generation happens entirely in your browser using the Web Crypto API. Your secret key never leaves your device.
For JWT generation, the payload must be valid JSON. The tool will automatically generate a JWT token with the standard header {"alg": "HS256", "typ": "JWT"}.
コード例
プロジェクトにすぐに使えるコードスニペットです。
Python
import hmac
import hashlib
import base64
secret = "my-secret-key".encode()
payload = '{"user":"alice","role":"admin"}'.encode()
# HMAC-SHA256 (hex output)
sig = hmac.new(secret, payload, hashlib.sha256).hexdigest()
print(sig) # e.g. a1b2c3d4...
# HMAC-SHA256 (Base64 output)
sig_b64 = base64.b64encode(
hmac.new(secret, payload, hashlib.sha256).digest()
).decode()
print(sig_b64)
# Verify a webhook signature
def verify_webhook(payload: bytes, sig: str, secret: bytes) -> bool:
expected = hmac.new(secret, payload, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, sig)
よくある質問
以下を検索するか、よくある質問をご覧ください。
HMAC(Hash-based Message Authentication Code)は、暗号学的ハッシュ関数と秘密暗号鍵を使用する特定のタイプのメッセージ認証コードです。
いいえ。HMAC生成はWeb Crypto APIを使用してブラウザ内で完全にクライアントサイドで行われます。
Related Tools
Base64 Converter
Encode text to Base64 or decode Base64 to text — all in one tool
JWT Encoder
Generate and sign JSON Web Tokens (JWT) using the HS256 algorithm securely
Basic Auth Decoder
Decode HTTP Basic Authentication headers to reveal username and password
Base64 Encoder
Encode plain text to Base64 format with UTF-8, ASCII, and ISO-8859-1 support