Skip to main content
The Deno 2 Release Candidate is here
Learn more
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function crypto.digest
import { crypto } from "https://deno.land/std@0.109.0/_wasm_crypto/mod.ts";
const { digest } = crypto;

Returns the digest of the given data using the given hash algorithm.

length will usually be left undefined to use the default length for the algorithm. For algorithms with variable-length output, it can be used to specify a non-negative integer number of bytes.

An error will be thrown if algorithm is not a supported hash algorithm or length is not a supported length for the algorithm.

Parameters

algorithm
data
length