addrFromImplicit static method

Uint8List addrFromImplicit(
  1. Uint8List tag
)

Generates an address from an implicit tag. This function seems to construct a 40-byte address by repeating parts of the tag. @param tag The input tag byte array. @returns A new 40-byte address byte array.

Implementation

static Uint8List addrFromImplicit(Uint8List tag) {
  final addr = Uint8List(TXADDRLEN);
  // Copy the first ADDR_TAG_LEN bytes of the tag to the beginning of addr
  addr.setAll(0, tag.sublist(0, ADDR_TAG_LEN));
  // Fill the remaining part of the address by repeating the tag bytes
  int remainingLength = TXADDRLEN - ADDR_TAG_LEN;
  for (int i = 0; i < remainingLength; i++) {
    addr[ADDR_TAG_LEN + i] = tag[i % tag.length];
  }
  return addr;
}