Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/dtils/hash/mod.ts>Sha512

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

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

await Sha512.hash("Hello!") // 3a928aa2cc3bf291a4657d1b51e0e087dfb1dea060c89d20776b8943d24e712ea65778fe608ddaee0a191bc6680483ad12be1f357389a2380f660db246be5844

Incremental hashing is also supported:

const sha = new Sha512()

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

sha.get() // c9754d63f472cd8cc34e07e9d33a489216215eed87ed516d216581b47cba9f940413a32a342cc1062e003e21fa2800e16516eaa33c227c34374484a0bbe1bb96

Methods

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

Static Methods

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