wotsSign static method

void wotsSign(
  1. Uint8List sig,
  2. Uint8List msg,
  3. Uint8List seed,
  4. Uint8List pubSeed,
  5. int offset,
  6. Uint8List addr,
)

Signs a message using WOTS

Implementation

static void wotsSign(
  Uint8List sig,
  Uint8List msg,
  Uint8List seed,
  Uint8List pubSeed,
  int offset,
  Uint8List addr,
) {
  if (msg.length < PARAMSN) {
    throw ArgumentError('WOTS message must be $PARAMSN bytes');
  }
  final lengths = List<int>.filled(WOTSLEN, 0);

  chainLengths(msg, lengths);
  expandSeed(sig, seed);

  final seed32 = pubSeed.sublist(offset, offset + PARAMSN);
  final bbaddr = addressBuffer(addr);

  for (int i = 0; i < WOTSLEN; i++) {
    WOTSHash.setChainAddr(bbaddr, i);
    genChain(
        sig, i * PARAMSN, sig, i * PARAMSN, 0, lengths[i], seed32, bbaddr);
  }
}