Comments (2)
and Fr_pow
from circom-witness-rs.
A.
To extend the eval
functions, we can do the following using ruint library:
Fr_neg --> Neg => (M - a)
assuming M is the field's order. This has been used to calculateSub
Fr_div --> Div => a.mul_mod (b.inv_mod(M), M)
use inv_mod fromruint::algorithms
as this uses Extended Euclidean Algorithm to calculate the inverse.Fr_pow --> Pow => a.pow_mod(b, M)
B.
To extend the eval_fr
functions, we can do the following:
The Prime Field Fr = Fp256<MontBackend<FrConfig, 4>>
elements are implemented using the ark_ff library, which provides functions for calculating negative, division, etc. Adding the following code to the graph.rs
file, under the impl Operation -> eval_fr
might work :
Neg => a.neg_in_place(),
FromString => Fr::from_str("testString"),
Div => a / b
Source:
- Ark prime fields library : ark_ff
- Ark BN254 curve example (similar to ark_bn254 curve used) : curve
- Arkworks-rs guide
- Arkworks-rs github
from circom-witness-rs.
Related Issues (9)
- NotFound, message: "No such file or directory" HOT 1
- supported prime numbers HOT 1
- Unclosed "{" in circuit.cc HOT 3
- Publish to crates.io
- index out of bounds: the len is 4 but the index is 4 HOT 1
- `Fr_isTrue called on non-constant` error for `IsZero` template
- `Fr_toInt` overflows
- Existing native cpp and arm64 asm implementations of Fr/Fq
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from circom-witness-rs.