All examples use BASE_URL — set it to your deployment URL.
POST/api/hash
Generate MD5, SHA-1, SHA-256, and SHA-512 hashes. Optionally specify a single algorithm.
const BASE_URL = "http://localhost:3000";
// Get all hashes at once:
const res = await fetch(`${BASE_URL}/api/hash`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: "hello world" })
});
// → { success: true, hashes: { md5: "5eb6...", sha1: "2aae...", sha256: "b94d...", sha512: "309e..." } }
// Or get a single algorithm:
await fetch(`${BASE_URL}/api/hash`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: "hello", algorithm: "sha256" })
});
// → { success: true, hashes: { sha256: "2cf2..." } }