Endo
    Preparing search index...

    Function makeChaCha12

    • Creates a ChaCha12-backed RandomGenerator keyed by key, with counter starting at 0 and an all-zero nonce.

      The returned ChaCha12Generator exposes both the pure-rand v8 RandomGenerator interface (next / clone / getState) and the pre-existing byte-fill fillRandomBytes method that conforms to @endo/random's RandomSource and crypto.getRandomValues-style ergonomics. Callers can pick whichever entry point matches the downstream consumer.

      After 2 ** 32 blocks (256 GiB of keystream) the counter would wrap; the generator throws RangeError instead.

      makeChaCha12 reads the key bytes once, into a private state vector, and does not retain the supplied Uint8Array reference. Callers do not need to defensively copy the key; passing a frozen or shared key array is safe.

      Parameters

      • key: Uint8Array<ArrayBufferLike>

        32-byte key.

      Returns ChaCha12Generator