Chacha20 constructor

Chacha20({
  1. required MacAlgorithm macAlgorithm,
})

Constructs a ChaCha20 with any MAC.

Unless you really know what you are doing, you should use Chacha20.poly1305Aead, which implements AEAD_CHACHA20_POLY1305 cipher ((RFC 7539).

Implementation

factory Chacha20({required MacAlgorithm macAlgorithm}) {
  if (macAlgorithm is DartChacha20Poly1305AeadMacAlgorithm) {
    return Cryptography.instance.chacha20Poly1305Aead();
  }
  return Cryptography.instance.chacha20(macAlgorithm: macAlgorithm);
}