sha-1, sha-256, sha-384, sha-512 via web crypto
curl -sX POST 'https://api.whittly.dev/v1/hash' \
-H 'Authorization: Bearer $WHITTLY_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"input":"hello world","algorithm":"sha256"}'
const res = await fetch('https://api.whittly.dev/v1/hash', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + apiKey,
'Content-Type': 'application/json',
},
body: JSON.stringify({ input: "hello world", algorithm: "sha256" }),
});
const data = await res.json();
const { data } = await axios.post(
'https://api.whittly.dev/v1/hash',
{ input: "hello world", algorithm: "sha256" },
{ headers: { Authorization: 'Bearer ' + apiKey } }
);
A cryptographic hash function maps data of any size to a fixed-length digest. SHA-256 produces a 64-character hex string; SHA-512 produces 128 characters. Hashes are one-way: you cannot recover the original input from the digest.