Cipher.aesCtr constructor

Cipher.aesCtr(
  1. List<int> key
)

AES in counter mode with a 128, 192 or 256-bit key, selected by the key length exactly like at_chops' AesCtrFactory.

Implementation

factory Cipher.aesCtr(List<int> key) {
  final bits = key.length * 8;
  if (bits != 128 && bits != 192 && bits != 256) {
    throw ArgumentError.value(
      key.length,
      'key',
      'AES-CTR needs a 16, 24 or 32 byte key',
    );
  }
  return Cipher._('AES-$bits-CTR', Uint8List.fromList(key));
}