Giter Site home page Giter Site logo

Comments (6)

dfaranha avatar dfaranha commented on June 18, 2024

Thanks! I think this is caused by a mismatch between the fp_print() and fp_cmp() functions. To facilitate debugging, fp_print() converts back from the Montgomery representation, while fp_cmp() compares raw digit vectors. Far from intuitive, I know. :(

Perhaps fp_cmp() should only perform equality checks, since a finite field does not admit a total order anyways?

from relic.

FiloSottile avatar FiloSottile commented on June 18, 2024

I see. I don’t know what the right answer is, but its semantics should not change based on a configuration option. In practice I do need lexicographic ordering for a point compression scheme I have to interoperate with. Does comparing Montgomery representations have any meaning?

from relic.

dfaranha avatar dfaranha commented on June 18, 2024

Agree, will move this to the DV module which does not care about fields and change fp_cmp() for equality checks, which work among different representations.

Comparing Montgomery representations does not conserve any ordering, since everything is multiplied by (R mod p); and you should not transmit coordinates in Montgomery form anyway. Maybe you should first export to byte vectors with fp_write_bin() and then perform the comparison?

from relic.

FiloSottile avatar FiloSottile commented on June 18, 2024

I meant that if comparing Montgomery representations is meaningless it would be reasonable to make fp_cmp convert back before comparing, but yeah also comparing fp_write_bin outputs works for me.

from relic.

dfaranha avatar dfaranha commented on June 18, 2024

Fixed the issue according to the solution suggested above in commit 78a1266

from relic.

dfaranha avatar dfaranha commented on June 18, 2024

Thanks again for reporting!

from relic.

Related Issues (20)

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.