aes<T extends Object?> static method

T aes<T extends Object?>(
  1. List<int> key,
  2. T use(
    1. BuBlockCipher cipher
    )
)

Runs use with a fresh AES block cipher built from key, then wipes it. The instance must be clean after you don't need it; this method guarantees that, even if use throws.

Implementation

static T aes<T extends Object?>(
  List<int> key,
  T Function(BuBlockCipher cipher) use,
) {
  final cipher = aesInstance(key);
  try {
    return use(cipher);
  } finally {
    cipher.clean();
  }
}