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,
) {
  final lengths = List<int>.filled(WOTSLEN, 0);

  // Compute lengths
  chainLengths(msg, lengths);

  // Expand seed
  expandSeed(sig, seed);

  // Create WotsAddress instance from addr bytes
  final wotsAddr = WotsAddress.wotsAddressFromBytes(addr);
  final bbaddr = ByteBuffer.wrap(wotsAddr.bytes().sublist(0, PARAMSN));
  bbaddr.order(ByteOrder.littleEndian);

  // Generate signature
  for (int i = 0; i < WOTSLEN; i++) {
    WOTSHash.setChainAddr(bbaddr, i);
    genChain(sig, i * PARAMSN, sig, i * PARAMSN, 0, lengths[i],
        pubSeed.sublist(offset), bbaddr.array());
  }
}