crypto.subtle.digest
FunctionGenerates a cryptographic hash of the given data using the specified algorithm.
- Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.
digest(
algorithm,data):Promise<Uint8Array<ArrayBufferLike>>
Generates a cryptographic hash of the given data using the specified algorithm. This method replicates crypto.subtle.digest() from the Web Crypto API, suitable for SHA and other algorithms.
algorithm The hash algorithm to use (e.g., "SHA1", "SHA256", "SHA384", "SHA512").
data The data to hash.
Returns: A Promise that resolves to the hashed output as an Uint8Array.
Parameters
| Parameter | Type |
|---|---|
algorithm | string |
data | Uint8Array |
Returns
Promise<Uint8Array<ArrayBufferLike>>