import { sha256 } from "https://deno.land/x/ayonli_jsext@v0.9.72/hash.ts";
Calculates the SHA-256 hash of the given data.
Examples
Example 1
Example 1
import { sha256 } from "@ayonli/jsext/hash";
const buffer = await sha256("Hello, World!");
console.log(buffer); // ArrayBuffer(32) { ... }
Parameters
data: DataSource
Examples
Example 1
Example 1
import { sha256 } from "@ayonli/jsext/hash";
const hex = await sha256("Hello, World!", "hex");
console.log(hex); // dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f
const base64 = await sha256("Hello, World!", "base64");
console.log(base64); // 3/1gIbsr1bCvZ2KQgJ7DpTGR3YHH9wpLKGiKNiGCmG8=
Parameters
data: DataSource