Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "salsa20/salsa20"

Index

Functions

Functions

stream

  • stream(key: Uint8Array, nonce: Uint8Array, dst: Uint8Array, nonceInplaceCounterLength?: number): Uint8Array
  • Generate Salsa20/20 stream for the given 32-byte key and 8-byte nonce and write it into dst and return it.

    Never use the same key and nonce to generate more than one stream.

    If nonceInplaceCounterLength is not 0, it behaves the same with respect to the nonce as described in streamXOR documentation.

    stream is like streamXOR with all-zero src.

    Parameters

    • key: Uint8Array
    • nonce: Uint8Array
    • dst: Uint8Array
    • Default value nonceInplaceCounterLength: number = 0

    Returns Uint8Array

streamXOR

  • streamXOR(key: Uint8Array, nonce: Uint8Array, src: Uint8Array, dst: Uint8Array, nonceInplaceCounterLength?: number): Uint8Array
  • 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
    • Default value nonceInplaceCounterLength: number = 0

    Returns Uint8Array

Generated using TypeDoc