wotsPkFromSig static method
Verifies a WOTS signature
Implementation
static Uint8List wotsPkFromSig(
Uint8List signature,
Uint8List msg,
Uint8List pubSeed,
Uint8List addr,
) {
final pk = Uint8List(WOTSSIGBYTES);
final lengths = List<int>.filled(WOTSLEN, 0);
// Copy and wrap address
final caddr = Uint8List.fromList(addr);
final wotsAddr = WotsAddress.wotsAddressFromBytes(caddr);
final bbaddr = ByteBuffer.wrap(wotsAddr.bytes().sublist(0, PARAMSN));
bbaddr.order(ByteOrder.littleEndian);
// Compute lengths
chainLengths(msg, lengths);
// Verify signature
for (int i = 0; i < WOTSLEN; i++) {
WOTSHash.setChainAddr(bbaddr, i);
genChain(pk, i * PARAMSN, signature, i * PARAMSN, lengths[i],
WOTSW - 1 - lengths[i], pubSeed, bbaddr.array());
}
return pk;
}