Comments (3)
I don't use Pedersen, only MiMC and Poseidon. This is my final workaround. :)
from circomlibjs.
Alright, I've read the related issue in the circomlib repo and been testing the suggestions there.
Very messy code but this should work:
const ffjavascript = require("ffjavascript");
const stringifyBigInts = ffjavascript.utils.stringifyBigInts;
const F = new ffjavascript.ZqField(
ffjavascript.Scalar.fromString(
"21888242871839275222246405745257275088548364400416034343698204186575808495617"
)
);
var b = Buffer.alloc(32);
// Just set b to whatever input you want
var h = pedersen.hash(b);
const hP = 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.
from circomlibjs.
Same issue here, have you found anything since then?
from circomlibjs.
Related Issues (16)
- Error on eddsa.sign()
- Official way to transform the UInt8Array output of Poseidon into a BigInt? HOT 7
- Discrepancy between Poseidon hashes in circom vs circomlibjs HOT 4
- Poseidon hash has changed
- Why there is no Poseidon contract generator for arbitrary number of hash inputs? HOT 5
- Failed generate Poseidon smart contract with inputs > 6 HOT 2
- Error when attempting to use buildPoseidon HOT 1
- Error on import inside worker module HOT 1
- Question about prune in eddsa
- Question about eddsa + poseidon
- Something weird with F.toString
- Modify ethers imports HOT 2
- Issue running in React.js (browser) HOT 4
- fix variable name in "eddsa.js: ensureBuffer"
- LICENSE missing
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 circomlibjs.