cairo_vm

Module math_utils

Source

Structs§

Functions§

  • Finds a nonnegative integer x < p such that (m * x) % p == n.
  • Doubles a point on an elliptic curve with the equation y^2 = x^3 + alpha*x + beta mod p. Assumes the point is given in affine form (x, y) and has y != 0.
  • Computes the slope of an elliptic curve with the equation y^2 = x^3 + alpha*x + beta mod p, at the given point. Assumes the point is given in affine form (x, y) and has y != 0.
  • Returns the integer square root of the nonnegative integer n. This is the floor of the exact square root of n. Unlike math.sqrt(), this function doesn’t have rounding error issues.
  • Computes the slope of the line connecting the two given EC points over the field GF(p). Assumes the points are given in affine form (x, y) and have different x coordinates.
  • Returns the nth (up to the 251th power) power of 2 as a Felt252 in constant time. It silently returns 1 if the input is out of bounds.
  • Returns the nth (up to the 251th power) power of 2 as a [&stark_felt::NonZeroFelt] in constant time. It silently returns 1 if the input is out of bounds.
  • Performs integer division between x and y; fails if x is not divisible by y.
  • Performs integer division between x and y; fails if x is not divisible by y.
  • Performs integer division between x and y; fails if x is not divisible by y.
  • Converts Felt252 into a BigInt number in the range: (- FIELD / 2, FIELD / 2).