variable / @typed/id/_sha

sha512

Digests bytes with Web Crypto SHA-512 and returns a fresh Uint8Array.

Package version
1.0.0-beta.7
Category
Hashing
Since
1.0.0

Import

import { sha512 } from "@typed/id/_sha";

Signatures

export declare const sha512: (data: BufferSource) => Effect.Effect<Uint8Array<ArrayBuffer>, never, never>;

Why

This published low-level helper exposes the exact domain-separated hash used by CUID formatting without hiding platform requirements. Missing Web Crypto and rejected subtle.digest promises are Effect defects because the typed error channel is never.

Ownership and lifetime

Each Effect owns one asynchronous Web Crypto request and transfers a fresh result buffer; it retains no input after completion.

Examples

import { sha512 } from "@typed/id/_sha"
import { Effect } from "effect"
const digest = Effect.runPromise(sha512(new TextEncoder().encode("seed")))

Source