polyMod static method

int polyMod(
  1. List<int> values
)

The BIP-173/BIP-350 checksum polynomial modulus.

Implementation

static int polyMod(List<int> values) {
  var chk = 1;
  for (final value in values) {
    final top = chk >> 25;
    chk = ((chk & 0x1ffffff) << 5) ^ value;
    for (var i = 0; i < 5; i++) {
      if ((top >> i) & 1 != 0) chk ^= _generator[i];
    }
  }
  return chk;
}