• Hashes a String using the given algorithm

    Example

    Hash a String using SHA-256

    const sha256hasher = hashString("SHA-256");
    const arrayBuffer = sha256hasher("test");

    const hexString = arrayBufferToHexString(arrayBuffer);
    console.log(hexString); // "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"

    Returns

    the ArrayBuffer containing the hash in binary form

    Parameters

    • algorithm: AlgorithmIdentifier

    Returns ((str: string) => Promise<ArrayBuffer>)

Generated using TypeDoc