You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alright, I've read the related issue in the circomlib repo and been testing the suggestions there.
Very messy code but this should work:
constffjavascript=require("ffjavascript");conststringifyBigInts=ffjavascript.utils.stringifyBigInts;constF=newffjavascript.ZqField(ffjavascript.Scalar.fromString("21888242871839275222246405745257275088548364400416034343698204186575808495617"));varb=Buffer.alloc(32);// Just set b to whatever input you want varh=pedersen.hash(b);consthP=babyjub.unpackPoint(h)[0];console.log((stringifyBigInts(F.fromRprLEM(hP))));
This should print the same hash circom logs during debugging (in decimal format obviously).
Also, here I used 256 bits long pedersen hash (not 248 like you), so buffer has to be 32 bytes long.
I tried to calculate Pedersen hash with circom and circomjs, but the results are different.
This is my circuit:
And this is my circomjs code:
If am I right publicSignals[0] should be equal to points[0] and publicSignals[1] should be equal to points[1], but the hashes are different.
Am I doing something wrong, or is it a bug in circomjs?
The text was updated successfully, but these errors were encountered: