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

x/ayonli_jsext/hash.ts>sha1

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

Calculates the SHA-1 hash of the given data.

Examples

Example 1

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

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

Returns

Promise<ArrayBuffer>

Examples

Example 1

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

const hex = await sha1("Hello, World!", "hex");
console.log(hex); // 0a0a9f2a6772942557ab5355d76af442f8f65e01

const base64 = await sha1("Hello, World!", "base64");
console.log(base64); // CgqfKmdylCVXq1NV12r0Qvj2XgE=

Parameters

encoding: "hex" | "base64"

Returns

Promise<string>