verify static method

bool verify(
  1. Uint8List commitment,
  2. BigInt amount,
  3. Uint8List mask
)

Implementation

static bool verify(Uint8List commitment, BigInt amount, Uint8List mask) {
  final expected = commit(amount, mask);
  if (expected.length != commitment.length) return false;
  var diff = 0;
  for (var i = 0; i < expected.length; i++) {
    diff |= expected[i] ^ commitment[i];
  }
  return diff == 0;
}