Looking for the most modern hash algorithm? This guide covers everything about SHA-3 hash generation via API, including its unique sponge construction, advantages over SHA-2, and implementation examples.
What is SHA3?
SHA-3 is the latest member of the Secure Hash Algorithm family, standardized by NIST in 2015. Unlike SHA-2, it's based on the Keccak algorithm using a unique "sponge construction" that makes it structurally different and provides defense-in-depth.
SHA-3 serves as a backup to SHA-2 in case vulnerabilities are ever discovered, providing algorithm diversity for critical security infrastructure.
SHA3 Variants
SHA-3 comes in several variants with different output sizes:
- SHA3-224: 224-bit output (56 hex characters)
- SHA3-256: 256-bit output (64 hex characters) - most common
- SHA3-384: 384-bit output (96 hex characters)
- SHA3-512: 512-bit output (128 hex characters)
- SHAKE128/256: Extendable output functions (XOF)
Using the SHA3 Hash API
TinyFn provides a flexible endpoint for all SHA3 variants:
POST https://api.tinyfn.io/v1/hash/sha3
Headers: X-API-Key: your-api-key
Content-Type: application/json
{
"input": "Hello, World!",
"bits": 256
}
{
"hash": "1af17a664e3fa8e419b8ba05c2a173169df76162a5a286e0c405b460d478f7ef",
"algorithm": "sha3-256",
"input_length": 13
}
Parameters
| Parameter | Type | Description |
|---|---|---|
input |
string | Text to hash (required) |
bits |
integer | Output size: 224, 256, 384, 512 (default: 256) |
encoding |
string | Input encoding: "utf8", "base64", "hex" (default: "utf8") |
output_format |
string | Output format: "hex", "base64" (default: "hex") |
Code Examples
JavaScript / Node.js
const response = await fetch(
'https://api.tinyfn.io/v1/hash/sha3',
{
method: 'POST',
headers: {
'X-API-Key': 'your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
input: 'Hello, World!',
bits: 256
})
}
);
const { hash } = await response.json();
console.log(hash); // 64-character hex string
Python
import requests
response = requests.post(
'https://api.tinyfn.io/v1/hash/sha3',
headers={'X-API-Key': 'your-api-key'},
json={
'input': 'Hello, World!',
'bits': 256
}
)
hash_value = response.json()['hash']
print(hash_value) # 64-character hex string
cURL
curl -X POST "https://api.tinyfn.io/v1/hash/sha3" \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{"input": "Hello, World!", "bits": 256}'
Common Use Cases
- Ethereum: SHA3-256 (Keccak-256) is used extensively in Ethereum
- Post-Quantum Preparation: Algorithm diversity for future-proofing
- High-Security Applications: When defense-in-depth is required
- Random Number Generation: SHAKE variants for flexible-length output
- Smart Contracts: Hashing in blockchain applications
Best Practices
- Use SHA3-256 for most applications: Good balance of security and performance
- Consider compatibility: SHA-2 is more widely supported; use SHA-3 when specifically needed
- No HMAC needed: SHA-3 is secure for authentication without HMAC wrapper
- Use SHAKE for variable output: When you need arbitrary-length hash output
Use via MCP
Your AI agent can call this tool directly via Model Context Protocol — no HTTP code needed. Add TinyFn to Claude Desktop, Cursor, or any MCP client:
{
"mcpServers": {
"tinyfn-hash": {
"url": "https://api.tinyfn.io/mcp/hash/",
"headers": {
"X-API-Key": "your-api-key"
}
}
}
}
See all hash tools available via MCP in our Hash MCP Tools for AI Agents guide.
Try the SHA3 Hash API
Get your free API key and start generating SHA3 hashes in seconds.
Get Free API Key