baseW_ static method

List<int> baseW_(
  1. Uint8List msg,
  2. List<int> destination,
  3. int offset,
  4. int length,
)

Converts message to base w

Implementation

static List<int> baseW_(
  Uint8List msg,
  List<int> destination,
  int offset,
  int length,
) {
  int inIdx = 0;
  int outIdx = 0;
  int total = 0;
  int bits = 0;

  for (int consumed = 0; consumed < length; consumed++) {
    if (bits == 0) {
      total = msg[inIdx++];
      bits += 8;
    }
    bits -= WOTSLOGW;
    destination[outIdx + offset] = (total >> bits) & (WOTSW - 1);
    outIdx++;
  }

  return destination;
}