isOrderScalar function

bool isOrderScalar(
  1. dynamic x
)

This function checks if a value 'x' is a valid scalar less than the elliptic curve group order. It first ensures that 'x' is a scalar and then compares it to the group order. It returns true if 'x' is a valid scalar less than the group order; otherwise, it returns false.

Implementation

bool isOrderScalar(x) {
  /// Check if 'x' is a valid scalar; if not, return false.
  if (!isScalar(x)) {
    return false;
  }

  /// Compare 'x' to the elliptic curve group order.
  /// If 'x' is less than the group order, return true; otherwise, return false.
  return _compare(x, _rcOrderBytes) < 0;

  /// < G
}