Computes a cryptographic hash of the input data using the specified algorithm.
The data to hash.
The hash algorithm to use. Defaults to 'SHA-256'.
A promise that resolves to the hash as a byte array.
Error if an unsupported hash algorithm is specified.
const hash = await hash(data, 'SHA-256') Copy
const hash = await hash(data, 'SHA-256')
Computes a cryptographic hash of the input data using the specified algorithm.