• Encrypt src with Salsa20/20 stream generated for the given 32-byte key and 8-byte and write the result into dst and return it.

    dst and src may be the same, but otherwise must not overlap.

    Never use the same key and nonce to encrypt more than one message.

    If nonceInplaceCounterLength is not 0, the nonce is assumed to be a 16-byte array with stream counter in first nonceInplaceCounterLength bytes and nonce in the last remaining bytes. The counter will be incremented inplace for each Salsa20 block. This is useful if you need to encrypt one stream of data in chunks.

    Parameters

    • key: Uint8Array
    • nonce: Uint8Array
    • src: Uint8Array
    • dst: Uint8Array
    • nonceInplaceCounterLength: number = 0

    Returns Uint8Array