HMAC-SHA Encrypt
Key length: 0 chars
Result

HMAC-SHA Tools

HMAC-SHAThis encryption tool is an essential online tool for developers, helping you compute HMAC message authentication codes for text. It supports four mainstream algorithms — HMAC-SHA1, HMAC-SHA256, HMAC-SHA384, and HMAC-SHA512 — and provides features such as text input, key generation, and file import/export, offering a complete HMAC solution for web development and data security.。

Key features

🔐 Multi-algorithm HMAC encryption

Supports four mainstream HMAC algorithms — HMAC-SHA1, HMAC-SHA256, HMAC-SHA384, and HMAC-SHA512 — to meet different security needs and use cases.。

HMAC-SHA256Example:
Message:Hello World
Key:secret
Hex:734cc62f32841568f45715aeb9f4d7891324e6d948e4c6c60c0621cdac48623a
Base64:c0zGLzKEFWj0VxWuufTXiRMk5tlI5MbGDAYhzaxIYjo=

HMAC-SHA1Example:
Message:Hello World
Key:secret
Hex:2aae6c35c94fcfb415dbe95f408b9ce91ee846ed
Base64:Kq5sNclPz7QV2+lfQIuc6R7oRu0=

🔑 Smart key management

Enter a key manually or generate a random one automatically, with key strength assessment and security recommendations.。

  • Supports keys of any length
  • Random key generation
  • Real-time key length display
  • Key security check
  • Key strength assessment
  • Best practice tips

📁 File handling

Supports importing and exporting text files for easy batch processing and data management.。

  • Text file import (TXT, JSON, CSS, JS, …)
  • HMACExport results
  • Save processing results
  • Preserves encoding
  • Large file support
  • Batch text processing

🔧 Smart detection

Automatically detects the input content and algorithm type, providing relevant processing recommendations and security tips.。

  • Automatic algorithm recommendation
  • Key strength assessment
  • Data format detection
  • Security recommendations
  • Error diagnostic hints
  • Best practice recommendations

How to use

1

Select an algorithm and enter your data

Choose a suitable HMAC algorithm (HMAC-SHA256 by default), enter the text to process in the editor, or click"Import text file"Load document content

2

Set HMAC key

Enter an HMAC key in the key field, or click "Generate random key"Generate a secure key automatically. The key can be a string of any length.

3

Calculate HMAC value

Click"CalculateHMAC"to generate a message authentication code. The result is shown on the right in two formats — hex and Base64 — with one-click copy and export supported.

What is HMAC-SHA?

HMAC(Hash-based Message Authentication Code,Hash-based Message Authentication Code) is a method for constructing a message authentication code using a cryptographic hash function. HMAC-SHA combines HMAC with SHA hash functions and is widely used in security domains such as data integrity verification, identity authentication, and API signing.。

HMAC-SHA Algorithm comparison

HMAC-SHA1

Output length: 160-bit (40 hex characters)

An older HMAC algorithm, still widely used in scenarios with high compatibility requirements such as OAuth 1.0 and JWT.

HMAC-SHA256

Output length: 256-bit (64 hex characters)

The most commonly used HMAC algorithm today, widely applied in modern scenarios such as API signing, JWT, and blockchain.

HMAC-SHA384

Output length: 384-bit (96 hex characters)

A high-security HMAC algorithm, suitable for enterprise applications with high security requirements.

HMAC-SHA512

Output length: 512-bit (128 hex characters)

The most secure HMAC algorithm, suitable for scenarios with extremely high security requirements such as government and finance.

Algorithm selection guide

When to use HMAC-SHA1

Scenario:Scenarios with high compatibility requirements

Example:OAuth 1.0、Legacy APIs, legacy systems

Note:For new projects, SHA256 or higher is recommended.

When to use HMAC-SHA256

Scenario:Recommended for modern applications

Example:API signing, JWT, Webhook verification

Benefits:High security, good performance, and broad support

When to use HMAC-SHA512

Scenario:Extremely high security requirements

Example:Financial transactions, government systems, critical infrastructure

Benefits:Highest security level, with stronger resistance to quantum computing

HMAC-SHA Use cases

🔐 APISignature verification

Verify the integrity and origin of API requests to prevent data tampering.

🌐 WebhookVerify

Verify that Webhook requests from third-party services are legitimate.

🔍 Data integrity

Verify whether data has been tampered with during transfer or storage.

🎫 JWTToken

the signing algorithm for JSON Web Tokens, ensuring token security

📊 Message queue

Message integrity verification in message queue systems.

🔧 Password storage

Key-based password hash storage for enhanced security.

HMAC vs Standard hash

🔒 Key protection

HMACCalculated with a key, so only those with the correct key can verify or generate a valid authentication code.

🛡️ Tamper resistance

Even if an attacker knows the message and hash value, they cannot forge a valid HMAC value without the key.

🌐 Highly standardized

HMACDefined by the RFC 2104 standard and widely adopted, with mature implementations in many programming languages.

🚀 Excellent performance

Based on a mature hash algorithm with high computational efficiency, suitable for high-concurrency scenarios.