iden3 / ffjavascript

Finite Field Library in Javascript
GNU General Public License v3.0
49 stars 56 forks source link

Cached curves may not be used properly #129

Closed cedoor closed 11 months ago

cedoor commented 1 year ago

It seems that the line of code at the bottom can be moved to the beginning of the buildBn128 function so that after the curve is cached, the code before it is not executed each time.

Moving that line to the beginning could potentially make proof verification and generation much faster (after the curve is cached).

https://github.com/iden3/ffjavascript/blob/2980e48dde8f800655ffba293b848b29e7425455/src/bn128.js#L35

The same happens within buildBls12381.