validateChecksum static method

void validateChecksum(
  1. List<int> payloadBytes,
  2. List<int> checksumBytesExp,
  3. List<int> checksumFct(
    1. List<int>
    )
)

Validate address checksum.

Implementation

static void validateChecksum(
  List<int> payloadBytes,
  List<int> checksumBytesExp,
  List<int> Function(List<int>) checksumFct,
) {
  final checksumBytesGot = checksumFct(payloadBytes);

  if (!bytesEqual(checksumBytesExp, checksumBytesGot)) {
    throw ArgumentException(
      'Invalid checksum',
    );
  }
}