fromBaseBytes function
Converts base bytes to data bytes
Implementation
List<int> fromBaseBytes(List<int> input, int base) {
int baseBit = (base - 1).bitLength;
final outLenInBits = input.length * baseBit;
int shift = (8 - (outLenInBits % 8)) % 8;
BigInt v = BigInt.zero;
for (int i = 0; i < input.length; i++) {
v <<= baseBit;
v |= BigInt.from(input[i] & byteMask);
}
v <<= shift;
final outLenInBytes = (outLenInBits / 8).ceil();
final ret = Uint8List(outLenInBytes);
for (int i = 0; i < outLenInBytes; i++) {
final byte = (v & byteMaskBigInt).toInt();
ret[ret.length - i - 1] = byte;
v >>= 8;
}
return ret;
}