stringTextToListHexPrefix function
Implementation
List stringTextToListHexPrefix(String string) {
List listDec = string.runes.toList();
List listHex = [];
int symbol6Hex = 0;
int textLength = 2;
int prefixLength = 0;
for (int a = 0; a < listDec.length; a++) {
String stringHex = listDec[a].toRadixString(16);
stringHex = isNotEven(stringHex);
if (stringHex.length > 3) {
/// If the hexadecimal value is more than three characters long, the following happens: First the prefix is created. For this the current counter
/// of the loop is added with textlength and then multiplied by 2, because decryption is done in single bytes. The number 1 and 2 indicate how
/// long the hexadecimal value is. Second we add the prefix to the first position or after the last prefix. Then the length of the prefix is
/// added to the current value, the textLength is increased by 1 or 2 depending on how long the symbol is, and finally the counter for the
/// six-digit hexadecimal values is increased if this was one.
List prefixList =
prefixInt((a + textLength) * 2, stringHex.length == 4 ? 1 : 2);
listHex.insertAll(prefixLength, prefixList);
prefixLength += prefixList.length;
textLength += stringHex.length == 4 ? 1 : 2;
symbol6Hex += stringHex.length == 4 ? 0 : 1;
}
listHex.add(stringHex);
}
List prefixTextLength = prefixInt(listDec.length + symbol6Hex, 0);
/// First the length of the text is added.
listHex.insertAll(0, prefixTextLength);
/// The semicolon is inserted so that you know where the last symbol is when decoding.
listHex.insert(prefixLength + prefixTextLength.length, "3b");
return bigIntHexList(listHex);
}