xchacha20 function

Uint8List xchacha20(
  1. List<int> message,
  2. List<int> key, {
  3. List<int>? nonce,
  4. Nonce64? counter,
})

Apply XChaCha20 cipher with the follwing parameters:

Parameters:

  • message : arbitrary length plain-text.
  • key : 32 bytes key.
  • nonce : 24 bytes nonce. (Default: random)
  • counter : 64-bit counter. (Default: 1)

Both the encryption and decryption can be done using this same method.

Implementation

@pragma('vm:prefer-inline')
Uint8List xchacha20(
  List<int> message,
  List<int> key, {
  List<int>? nonce,
  Nonce64? counter,
}) =>
    XChaCha20(key, nonce, counter).convert(message);