Skip to main content
Module

x/dtils/mod.unstable.ts>Sha256

The best unofficial library of utilities for Deno applications
Go to Latest
class Sha256
import { Sha256 } from "https://deno.land/x/dtils@2.6.0/mod.unstable.ts";

A utility for creating an Sha256 hash from a string or Uint8Array.

await Sha256.hash("Hello!") // 334d016f755cd6dc58c53a86e183882f8ec14f52fb05345887c8a5edd42c87b7

Incremental hashing is also supported:

const sha = new Sha256()

sha.append("Hello")
sha.append("World!")

sha.get() // d5c49b74a17cc9fbedf02aec7f3f87bdeab2ab5233ac7ef49a8bbb66ce77f8f4

Methods

append(contents: Uint8Array | string): Promise<void>
get(): string

Static Methods

hash(contents: Uint8Array | string): Promise<string>