kkrt-labs / cairo-vm-ts

A typescript implementation of the Cairo VM
Apache License 2.0
20 stars 13 forks source link

feat: implement proper felt division #49

Closed zmalatrax closed 6 months ago

zmalatrax commented 6 months ago

Currently the div method of the Felt class implements an integer division of bigint, when it should perform a proper felt division.

I'd lean towards Euler's totient function as the modulus $p$ is prime, it is pretty straightforward: $\forall a \in \mathbb{F}_p \text{, } a^{-1} \equiv a^{p-2} \bmod p$