Oslo

sha256()

Generates a SHA-256 hash.

Definition

function sha256(data: ArrayBuffer | TypedArray): Promise<ArrayBuffer>;

Parameters

  • data

Example

import { sha256 } from "oslo/crypto";
import { encodeHex } from "oslo/encoding";

const data = new TextEncoder().encode("hello, world");
const hash = await sha256(data);
const hexHash = encodeHex(hash);