encode method

Map<String, dynamic> encode(
  1. List<int> password,
  2. List<int> data
)

Implementation

Map<String, dynamic> encode(List<int> password, List<int> data) {
  final derived = List<int>.unmodifiable(kdf.deriveKey(password));
  final macBytes = List<int>.unmodifiable(derived.sublist(16, 32));
  final aesKey = List<int>.from(derived.sublist(0, 16));
  final encryptOut = QuickCrypto.processCtr(key: aesKey, iv: iv, data: data);
  return {
    "cipher": "aes-128-ctr",
    "cipherparams": {'iv': BytesUtils.toHexString(iv)},
    "ciphertext": BytesUtils.toHexString(encryptOut),
    "kdf": kdf.type.name,
    "kdfparams": kdf.encode(),
    "mac": _mac(macBytes, encryptOut),
  };
}