encrypt method

  1. @override
List<int> encrypt(
  1. List<int> data
)

Implementation

@override
List<int> encrypt(List<int> data) {
  _emptyContentValidation(data);
  var encrypted = defaultCryptor.encrypt(data);
  if (encrypted.metadata.isEmpty) return encrypted.data;
  var header =
      CryptorHeader.from(defaultCryptor.identifier, encrypted.metadata);
  var headerData = List<int>.filled(header!.length, 0);
  var pos = 0;
  headerData.setAll(pos, header.data);
  pos = header.length - encrypted.metadata.length;
  headerData.setAll(pos, encrypted.metadata);
  return [...headerData, ...encrypted.data];
}