keyFromParts static method
Rebuilds the key from parts that XOR together. Keeping the key as several scattered parts (and building with --obfuscate) means it never appears as one block in the executable. pack_assets --gen-key prints the parts for you.
Implementation
static List<int> keyFromParts(List<List<int>> parts) {
final key = List<int>.filled(parts.first.length, 0);
for (final p in parts) {
if (p.length != key.length) {
throw ArgumentError('All key parts must be the same length');
}
for (var i = 0; i < key.length; i++) {
key[i] ^= p[i];
}
}
return key;
}