Giter VIP home page Giter VIP logo

Comments (7)

manueljishi avatar manueljishi commented on September 15, 2024 2

Hello @bmdelacruz,
I finally managed to solve my issue (using PedersenHash), te solution was to use a mix of utils.leBuf2Int, utils.leInt2Buf and stringifyBigInts depending on the input the functions were expecting.
Hope you can manage to solve yours

from circomlibjs.

bmdelacruz avatar bmdelacruz commented on September 15, 2024 1

I found one which can be used without ffjavascript. someLEBufferToBigIntFunction can be ffjavascript.utils.leBuff2int but it's easy to write it by yourself.

const expectedBigInt = someLEBufferToBigIntFunction(
  poseidon.F.fromMontgomery(poseidon([/* some input */]))
)

from circomlibjs.

bmdelacruz avatar bmdelacruz commented on September 15, 2024 1

@manueljishi Thank you very much!

from circomlibjs.

manueljishi avatar manueljishi commented on September 15, 2024

Hello there,
same issue here.
Could you explain your methos a little more? Where does that string come from?
Thank you very much

from circomlibjs.

bmdelacruz avatar bmdelacruz commented on September 15, 2024

Sorry @manueljishi but I have no logical explanation for that code.

I was trying to recreate the normalize call at the end of the poseidon function in v0.0.8. But since poseidon.F does not have a normalize function, I tried to recreate the BN128 curve using the ZqField class which has a normalize function. I was very disappointed when I called ZqField.normalize because I got an error–it needs a BigInt input. Out of frustration, I tried the functions under the ZqField class that does not look like a math operation and stumbled upon fromRprLEM. πŸ˜…

That string is the prime for the bn128 curve and it probably came from here.

from circomlibjs.

bmdelacruz avatar bmdelacruz commented on September 15, 2024

@manueljishi, just for a reference in the future, how do you use pedersenHash.hash and transform its output to bigint?

I tried using it out of curiousity but I can't seem to get the same value the circuit produces. I also tried passing its output to pedersenHash.babyJub.unpackPoint but none of its outputs matched what I expected.

Your response would be very much appreciated.

from circomlibjs.

manueljishi avatar manueljishi commented on September 15, 2024

@bmdelacruz I am using JavaScript to test my circuits, this is how I am parsing all the data https://github.com/Elpacos/Zk_voting_system/blob/main/test/generate_circuit_witness.js
Hope this helps you

from circomlibjs.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.