ScMinimal function

bool ScMinimal(
  1. Uint8List scalar
)

ScMinimal returns true if the given scalar is less than the order of the curve.

Implementation

bool ScMinimal(Uint8List scalar) {
  for (var i = 3;; i--) {
    ///    var v = binary.LittleEndian.Uint64(scalar[i*8:]);
    var v = Uint64(scalar.sublist(i * 8, scalar.length));
    if (v > order[i]) {
      return false;
    } else if (v < order[i]) {
      break;
    } else if (i == 0) {
      return false;
    }
  }

  return true;
}