Skip to content

Hash

Compute a cryptographic hash of a string, or verify an HMAC signature.

POST /api/hash

FieldTypeRequiredDefaultDescription
inputstringYesString to hash
algorithmstringNosha256md5, sha1, sha256, sha512, blake3, hmac-sha256
encodingstringNohexOutput encoding: hex, base64
keystringNoHMAC key. Required when algorithm is hmac-sha256
FieldTypeDescription
hashstringComputed hash value
algorithmstringAlgorithm used
encodingstringOutput encoding used
Terminal window
curl -X POST https://morso.dev/api/hash \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input": "hello world"}'
{
"hash": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9",
"algorithm": "sha256",
"encoding": "hex"
}
Terminal window
curl -X POST https://morso.dev/api/hash \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"algorithm": "hmac-sha256", "input": "hello world", "key": "my-secret"}'
{
"hash": "cf405b2def200d91098da8663e531d579ae1c71c90fe73d623ae2138eef2ad8b",
"algorithm": "hmac-sha256",
"encoding": "hex"
}
Terminal window
curl -X POST https://morso.dev/api/hash \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input": "hello world", "encoding": "base64"}'
{
"hash": "uU0nuZNNPgilLlLX2n2r+sSE7+N6U4DukIj3rOLvzek=",
"algorithm": "sha256",
"encoding": "base64"
}
  • 422algorithm is hmac-sha256 but key is missing.

See Errors for the standard error shape.