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

x/ayonli_jsext/hash.ts>sha512

A JavaScript extension package for building strong and modern applications.
Latest
function sha512
import { sha512 } from "https://deno.land/x/ayonli_jsext@v0.9.72/hash.ts";

Calculates the SHA-512 hash of the given data.

Examples

Example 1

import { sha512 } from "@ayonli/jsext/hash";

const buffer = await sha512("Hello, World!");
console.log(buffer); // ArrayBuffer(64) { ... }

Returns

Promise<ArrayBuffer>

Examples

Example 1

import { sha512 } from "@ayonli/jsext/hash";

const hex = await sha512("Hello, World!", "hex");
console.log(hex);
// 374d794a95cdcfd8b35993185fef9ba368f160d8daf432d08ba9f1ed1e5abe6cc69291e0fa2fe0006a52570ef18c19def4e617c33ce52ef0a6e5fbe318cb0387

const base64 = await sha512("Hello, World!", "base64");
console.log(base64);
// N015SpXNz9izWZMYX++bo2jxYNja9DLQi6nx7R5avmzGkpHg+i/gAGpSVw7xjBne9OYXwzzlLvCm5fvjGMsDhw==

Parameters

encoding: "hex" | "base64"

Returns

Promise<string>