Hash API: MD5, SHA-1, SHA-256, SHA-512, SHA3 and BLAKE2b
A hash is a fixed-length fingerprint of some data: change one letter and the whole fingerprint changes. This endpoint hashes up to 4 KB of UTF-8 text with any of seven common algorithms, or all of them in one go.
/v1/hash?text=hello&algo=all returns JSON. No key, CORS on, 60 requests a minute./v1/hash
Hash a short text (MD5, SHA-1, SHA-2, SHA-3, BLAKE2b). Change the values and press Send request to call the live API.
Parameters
| Name | Type | What it does | Default |
|---|---|---|---|
text required | string | Up to 4 KB of UTF-8 text | — |
algo | string | Algorithm or 'all' Allowed: md5, sha1, sha256, sha384, sha512, sha3-256, blake2b, all | sha256 |
Example
Request:
GET https://api.oddlathe.com/v1/hash?text=hello&algo=all
Response (generated by the real code when these docs were last built; random or time-based values will differ for you):
{
"bytes": 5,
"hashes": {
"md5": "5d41402abc4b2a76b9719d911017c592",
"sha1": "aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d",
"sha256": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824",
"sha384": "59e1748777448c69de6b800d7a33bbfb9ff1b463e44354c3553bcdb9c666fa90125a3c79f90397bdf5f6a13de828684f",
"sha512": "9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043",
"sha3-256": "3338be694f50c5f338814986cdf0686453a888b84f424d792af4b9202398f392",
"blake2b": "e4cfa39a3d37be31c59609e807970799caa68a19bfaa15135f165085e01d41a65ba1e1b146aeb6bd0092b49eac214c103ccfa3a365954bbbe52f74a2b3620c94"
}
}
Code examples
curl 'https://api.oddlathe.com/v1/hash?text=hello&algo=all'const params = new URLSearchParams({
text: "hello",
algo: "all"
});
const res = await fetch(`https://api.oddlathe.com/v1/hash?${params}`);
if (!res.ok) throw new Error((await res.json()).error.message);
const data = await res.json();
console.log(data);import json, urllib.parse, urllib.request
params = urllib.parse.urlencode({"text": "hello", "algo": "all"})
url = "https://api.oddlathe.com/v1/hash?" + params
# Send a User-Agent: the edge network refuses Python's default one.
req = urllib.request.Request(url, headers={"User-Agent": "my-script/1.0"})
with urllib.request.urlopen(req, timeout=10) as r:
data = json.load(r)
print(data)When it's useful
- Checking a value against a published checksum
- Cache keys or deduplication in no-code tools
- Teaching or comparing hash functions
Good to know
- Text travels in the URL, which proxies and browser history can see. Don't hash passwords or secrets here: use the Tooltern hash generator, which runs entirely in your browser.
- Text is encoded as UTF-8 before hashing, so the result matches
printf '%s' 'text' | sha256sum(no trailing newline). - MD5 and SHA-1 are broken for security (collisions can be made on purpose). They're here for compatibility with old checksums only.
Text travels in the URL, so don't hash secrets here. Use Tooltern's in-browser hash tool for anything private.
Errors
Errors are JSON like {"error": {"code": "…", "message": "…"}}. The ones this endpoint can return:
missing_param(400): a required parameter is missing or emptybad_param(400): a value is the wrong type or out of range (the message says which)too_long(413): text is over 4 KBrate_limited(429): over 60 requests a minute; wait for Retry-After seconds
Questions
Why doesn't my hash match the one from echo?
echo adds a newline. Use printf '%s' or echo -n.
Can I hash a file?
Not through this endpoint (4 KB text cap). Tooltern's hash generator hashes files locally without uploading them.
Which algorithm should I use?
SHA-256 is the safe default. BLAKE2b is fast and strong. Use a slow password hash (Argon2, bcrypt, scrypt) for storing passwords, never a plain hash.
Related endpoints
Prefer a page to an API?
- Hash generator for text and files (in your browser) on Tooltern: same job, nothing leaves your browser.
Published · OpenAPI 3.1 spec · Limits and privacy