Hash Generator

Hash Generator API

Security

Hash text or files with MD5, SHA-1, SHA-256, SHA-384, SHA-512, SHA3-256, CRC32 and xxHash64, with optional HMAC, and check a download against its expected checksum.

Authentication

All API requests require a valid API key passed in the Authorization header as a Bearer token.

Rate Limit

120 requests per minute

Endpoints

1 endpoint available

Overview

Hash text or a file with MD5, SHA-1, SHA-256, SHA-384, SHA-512, SHA3-256, CRC32 and xxHash64, optionally as an HMAC. The request is multipart/form-data: send either a text field or a file, not both.

Form fields

  • text: text to hash, hashed as UTF-8, up to 1,000,000 characters. An empty string is allowed.
  • file: a file to hash, up to 10 MB. For bigger files use the web page, which streams them in your browser.
  • algorithms: comma-separated list of algorithms. Default: all of them.
  • output: "hex" (default), "HEX" for upper case, or "base64".
  • hmacKey: optional. When set, MD5, SHA-1, SHA-2 and SHA3-256 are computed as HMACs with this key.
  • hmacKeyFormat: "text" (default, the key is UTF-8) or "hex".
  • expected: optional hash to check. The response says which algorithm it matches. It can be hex in any case or Base64, and the "hash filename" line from sha256sum works.

Algorithm ids

md5, sha1, sha256, sha384, sha512, sha3-256, crc32, xxhash64.

Notes

  • HMAC is not defined for CRC32 and xxHash64. When a key is sent, those two come back as plain hashes and are listed in hmacSkipped.
  • MD5, SHA-1, CRC32 and xxHash64 are fine for checksums but are not secure for passwords or signatures.
  • match is only present when expected is sent. It is the algorithm id, or null if nothing matched.

Endpoints

POST
https://opentools.ca/api/v1/tools/hash-generator
Hash text or a file

Request Body

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
text
string
OptionalText to hash. Send this or file.
file
file
OptionalFile to hash, up to 10 MB. Send this or text.
algorithms
string
OptionalComma-separated algorithm ids: md5, sha1, sha256, sha384, sha512, sha3-256, crc32, xxhash64Default: all
output
string
Enum: hex, HEX, base64
OptionalOutput encodingDefault: hex
hmacKey
string
OptionalHMAC key, up to 10,000 characters
hmacKeyFormat
string
Enum: text, hex
OptionalHow to read hmacKeyDefault: text
expected
string
OptionalA hash to compare against

Response Example

{
  "success": true,
  "input": {
    "type": "text",
    "bytes": 5
  },
  "output": "hex",
  "hmac": false,
  "hashes": {
    "md5": "5d41402abc4b2a76b9719d911017c592",
    "sha256": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
  }
}

Error Codes

400
Bad Request - Neither or both of text and file sent, unknown algorithm, or invalid hex key
401
Unauthorized - Invalid or missing API key
403
Forbidden - API key is inactive or expired, or the request IP is not allowed
413
Payload Too Large - File over 10 MB or text over 1,000,000 characters
429
Too Many Requests - Rate limit exceeded
500
Internal Server Error

Code Examples

# Hash text
curl -X POST https://opentools.ca/api/v1/tools/hash-generator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --form-string "text=hello" \
  --form-string "algorithms=md5,sha256"

# Hash a file as an HMAC
curl -X POST https://opentools.ca/api/v1/tools/hash-generator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@document.pdf" \
  --form-string "algorithms=sha256" \
  --form-string "hmacKey=secret"

Ready to get started?

Create an API key to start using the Hash Generator API.

Rather use it in your browser? Open the Hash Generator