Skip to main content

crypto.subtle.digest

Function

Generates 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.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • 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

ParameterType
algorithmstring
dataUint8Array

Returns

Promise<Uint8Array<ArrayBufferLike>>