wotsChecksum static method

List<int> wotsChecksum(
  1. List<int> msgBaseW,
  2. int sumOffset
)

Computes WOTS checksum

Implementation

static List<int> wotsChecksum(List<int> msgBaseW, int sumOffset) {
  int csum = 0;

  // Compute checksum
  for (int i = 0; i < WOTSLEN1; i++) {
    csum += (WOTSW - 1) - msgBaseW[i];
  }

  // Shift left by WOTSLOGW bits
  csum <<= WOTSLOGW;

  // Convert to bytes and base w
  final csumBytes = Uint8List(2);
  csumBytes[0] = (csum >> 8) & 0xFF;
  csumBytes[1] = csum & 0xFF;

  return baseW_(csumBytes, msgBaseW, sumOffset, msgBaseW.length - sumOffset);
}