import { crypto } from "https://dotland.deno.dev/std@0.119.0/_wasm_crypto/mod.ts";
const { DigestContext } = crypto;
A context for incrementally computing a digest using a given hash algorithm.
Methods
Returns a new DigestContext
that is a copy of this one, i.e., using the
same algorithm and with a copy of the same internal state.
This may be a more efficient option for computing multiple digests that start with a common prefix.
Returns the digest of the input data so far. This may be called repeatedly without side effects.
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.
Returns the digest of the input data so far, and then drops the context from memory on the WASM side. This context must no longer be used, and any further method calls will result in null pointer errors being thrown. https://github.com/rustwasm/wasm-bindgen/blob/bf39cfd8/crates/backend/src/codegen.rs#L186
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.
Returns the digest of the input data so far, and resets this context to its initial state, as though it has not yet been provided with any input data. (It will still use the same 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.
Resets this context to its initial state, as though it has not yet been provided with any input data. (It will still use the same algorithm.)
Update the digest's internal state with the additional input data
.
If the data
array view is large, it will be split into subarrays (via
JavaScript bindings) which will be processed sequentially in order to
limit the amount of memory that needs to be allocated in the WASM heap.