Git Product home page Git Product logo

Comments (6)

tarcieri avatar tarcieri commented on July 22, 2024 1

Thus far we've deliberately avoided exposing field elements in order to provide a misuse resistant API.

For hash2curve specifically my suggestion would be defining traits for hash2curve in the elliptic-curve crate and then implementing them directly in k256/p256.

cc @str4d

from elliptic-curves.

str4d avatar str4d commented on July 22, 2024 1

I agree with @tarcieri. I would definitely like to see a hash-to-curve trait (either in group or elliptic-curve) that can provide this functionality, and if the hash-to-field component of the ID proves to be more widely-useful, then a trait to that effect could end up in ff.

from elliptic-curves.

randombit avatar randombit commented on July 22, 2024

Wouldn't this effectively require implementing SSWU and related logic twice, once for each curve?

from elliptic-curves.

tarcieri avatar tarcieri commented on July 22, 2024

You should be able to define it as e.g. a generic function somewhere like elliptic-curve.

If you're having trouble go ahead and do a copy-and-paste definition for each crate individually and I can take a look at extracting out a generic implementation.

from elliptic-curves.

tarcieri avatar tarcieri commented on July 22, 2024

Another approach that might work for abstracting SSWU would be to define a trait (e.g. Sswu) intended to be impl'd on a curve-specific FieldElement type, which has a map_to_curve_simple_swu function with a default impl and an associated curve-specific const Z.

Then all curve-specific impls of that trait would need to do is define Z.

Something like this perhaps?

pub trait Sswu: // arithmetic bounds go here
{
    const Z: Self;

    fn map_to_curve_simple_swu(&self) -> (Self, Self) {
        ...
    }
}

from elliptic-curves.

tarcieri avatar tarcieri commented on July 22, 2024

Generic optimized SWU has been added upstream to the elliptic-curve crate: RustCrypto/traits#854

from elliptic-curves.

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.