Hash file
Try it interactively →POST /api/hash-fileCompute SHA-1, SHA-256, SHA-384, or SHA-512 hash of a file. Returns the digest in hex. The standard primitive for content fingerprinting and integrity checks.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| data* | file | — | Bytes to hash. |
| algorithm | enum (SHA-1 | SHA-256 | SHA-384 | SHA-512) | "SHA-256" | Hash algorithm. |
Response
Modes: json. Cache: yes (24h TTL).
Code samples
Built from the abc example.
# Download or substitute the example input:
# curl -O https://xtract.bot/examples/hash-file/abc.txt
DATA=$(base64 -w0 < abc.txt)
curl -X POST https://api.xtract.bot/api/hash-file \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
-H "X-Api-Key: $XTRACT_API_KEY" \
-d '{
"algorithm": "SHA-256",
"data": "'"$DATA"'"
}'