Known text
A reproducible SHA-1 test vector for checking an integration.
cURL
curl --fail-with-body --request POST 'https://www.base64.sh/api/v1/sha1-hash/' \
--user-agent 'Base64.sh API example/1.0' --header 'Content-Type: application/json' \
--data-raw '{"text":"abc"}'
JavaScript
const response = await fetch("https://www.base64.sh/api/v1/sha1-hash/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"text": "abc"
})
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
Python
import json
from urllib.request import Request, urlopen
payload = json.loads("{\n \"text\": \"abc\"\n}")
request = Request(
"https://www.base64.sh/api/v1/sha1-hash/",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={"Content-Type": "application/json", "User-Agent": "Base64.sh API example/1.0"},
method="POST",
)
with urlopen(request, timeout=15) as response:
print(json.load(response))
Response · HTTP 200
{
"ok": true,
"data": {
"algorithm": "SHA-1",
"hex": "a9993e364706816aba3e25717850c26c9cd0d89d"
}
}