splitAddress static method

void splitAddress(
  1. Uint8List address,
  2. Uint8List pk,
  3. Uint8List pubSeed,
  4. Uint8List rnd2,
  5. Uint8List? tag,
)

Splits a WOTS address into its components

Implementation

static void splitAddress(
  Uint8List address,
  Uint8List pk,
  Uint8List pubSeed,
  Uint8List rnd2,
  Uint8List? tag,
) {
  if (address.length != 2208) {
    throw ArgumentError('Invalid address length');
  }
  if (pk.length != WOTSSIGBYTES) {
    throw ArgumentError('Invalid pk length');
  }
  if (pubSeed.length != PARAMSN) {
    throw ArgumentError('Invalid pubSeed length');
  }
  if (rnd2.length != PARAMSN) {
    throw ArgumentError('Invalid rnd2 length');
  }
  if (tag != null && tag.length != 12) {
    throw ArgumentError('Invalid tag length');
  }

  // Copy components
  pk.setRange(0, WOTSSIGBYTES, address, 0);
  pubSeed.setRange(0, PARAMSN, address, WOTSSIGBYTES);
  rnd2.setRange(0, PARAMSN, address, WOTSSIGBYTES + PARAMSN);

  // Copy tag if provided
  if (tag != null) {
    tag.setRange(0, 12, rnd2, 20);
  }
}