Compute a cryptographic hash digest using the Web Crypto API.
One of "SHA-1", "SHA-256", "SHA-384", "SHA-512".
"SHA-1"
"SHA-256"
"SHA-384"
"SHA-512"
The data to hash (string or bytes).
Hex-encoded digest string.
const digest = await hash("SHA-256", "hello world"); Copy
const digest = await hash("SHA-256", "hello world");
Compute a cryptographic hash digest using the Web Crypto API.