sha-1, sha-256, sha-384, sha-512
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 } }
);
Криптографическая хеш-функция преобразует данные любого размера в дайджест фиксированной длины. SHA-256 даёт 64-символьную строку в hex; SHA-512 — 128 символов. Хеши однонаправленные: восстановить исходные данные из дайджеста нельзя.