@blockchaincommons/crypto - v1.0.0-beta.3
    Preparing search index...

    Function chacha20

    • XORs data with the ChaCha20 keystream for key (32 bytes) and nonce (12 bytes), starting at block counter. Applying it twice restores the input. There is no bc-crypto function for this; it is provenance-mark's ChaCha20::new + apply_keystream (the chacha20 crate).

      Parameters

      • key: Uint8Array
      • nonce: Uint8Array
      • data: Uint8Array
      • Optionaloptions: Chacha20Options

      Returns Uint8Array<ArrayBuffer>

      InvalidParameter on a non-Uint8Array argument or a non-object options; InvalidSize on a wrong-length key or nonce; InvalidParameter if counter is outside [0, 2^32 - 2] or the data would use the backend-reserved block counter 2^32 - 1.