aesEcbEncrypt function

Uint8List aesEcbEncrypt(
  1. Uint8List plaintext,
  2. Uint8List key
)

AES-256-ECB encrypt (deterministic, no IV). PKCS7 padded. Matches Python's non_iv_scramble.

Implementation

Uint8List aesEcbEncrypt(Uint8List plaintext, Uint8List key) {
  final padded = _pkcs7Pad(plaintext);
  final cipher = AESEngine()..init(true, KeyParameter(key));

  final out = Uint8List(padded.length);
  for (var offset = 0; offset < padded.length; offset += 16) {
    cipher.processBlock(padded, offset, out, offset);
  }
  return out;
}