SHA-256 hash of input
⚡ GenCompute SHA-256 hash of a string
$ echo "hello world" | hash async (input) => {
const data = new TextEncoder().encode(input);
const hash = await crypto.subtle.digest("SHA-256", data);
return Array.from(new Uint8Array(hash))
.map((b) => b.toString(16).padStart(2, "0"))
.join("");
}