Hash
Compute a cryptographic hash of a string, or verify an HMAC signature.
POST /api/hash
Parameters
Section titled “Parameters”| Field | Type | Required | Default | Description |
|---|---|---|---|---|
input | string | Yes | — | String to hash |
algorithm | string | No | sha256 | md5, sha1, sha256, sha512, blake3, hmac-sha256 |
encoding | string | No | hex | Output encoding: hex, base64 |
key | string | No | — | HMAC key. Required when algorithm is hmac-sha256 |
Response
Section titled “Response”| Field | Type | Description |
|---|---|---|
hash | string | Computed hash value |
algorithm | string | Algorithm used |
encoding | string | Output encoding used |
Examples
Section titled “Examples”SHA-256 hash
Section titled “SHA-256 hash”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"}HMAC-SHA256
Section titled “HMAC-SHA256”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"}Base64 encoding
Section titled “Base64 encoding”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"}Errors
Section titled “Errors”- 422 —
algorithmishmac-sha256butkeyis missing.
See Errors for the standard error shape.