Coder Social home page Coder Social logo

Comments (3)

davidnevadoc avatar davidnevadoc commented on July 2, 2024

Thanks for pointing this out! Could you have a look at #8 and let me know if it fixes the issue? @zhenfeizhang

from halo2curves.

zhenfeizhang avatar zhenfeizhang commented on July 2, 2024

Yes it fixed the issue.

I suggest to replace/add the following to the curve test in the fix:

pub fn curve_tests<G: CurveExt>() {
    is_on_curve::<G>();
    equality::<G>();
    projective_to_affine_affine_to_projective::<G>();
    projective_addition::<G>();
    mixed_addition::<G>();
    multiplication::<G>();
    batch_normalize::<G>();
    serdes::<G>();
}

fn serdes<G: CurveExt>() {
    for _ in 0..100 {
        let projective_point = G::random(OsRng);
        let affine_point: G::AffineExt = projective_point.into();
        let projective_repr = projective_point.to_bytes();
        let affine_repr = affine_point.to_bytes();

        let projective_point_rec = G::from_bytes(&projective_repr).unwrap();
        let projective_point_rec_unchecked = G::from_bytes(&projective_repr).unwrap();
        let affine_point_rec = G::AffineExt::from_bytes(&affine_repr).unwrap();
        let affine_point_rec_unchecked = G::AffineExt::from_bytes(&affine_repr).unwrap();

        assert_eq!(projective_point, projective_point_rec);
        assert_eq!(projective_point, projective_point_rec_unchecked);
        assert_eq!(affine_point, affine_point_rec);
        assert_eq!(affine_point, affine_point_rec_unchecked);
    }
}

from halo2curves.

davidnevadoc avatar davidnevadoc commented on July 2, 2024

Good idea! Added in 280141c

from halo2curves.

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.