Git Product home page Git Product logo

Comments (14)

tarcieri avatar tarcieri commented on July 22, 2024 1

As noted in #269, I think you want k256::ecdsa::recoverable::Signature.

from elliptic-curves.

tarcieri avatar tarcieri commented on July 22, 2024

You need to enable the sha256 feature.

(I see this is not documented at the moment)

from elliptic-curves.

tarcieri avatar tarcieri commented on July 22, 2024

I might do a follow-up release that enables sha256 feature as part of the ecdsa feature.

It was removed as some users may only care about other digest functions (e.g. keccak256) but eliminating the superfluous dependency for those users probably isn't worth the confusion it causes.

from elliptic-curves.

jedisct1 avatar jedisct1 commented on July 22, 2024

Thanks!

Not enabling it as part of the ecdsa feature is fine. People may also want to use a different sha256 implementation.

What is actually confusing is the fact that the sign() and verify() functions are available when the sha256 is not enabled, even though they cannot be used.

from elliptic-curves.

jedisct1 avatar jedisct1 commented on July 22, 2024

sign_with_rng() also seems to be gone (not sign_digest_with_rng()).

Is that intentional?

from elliptic-curves.

tarcieri avatar tarcieri commented on July 22, 2024

I can gate those on the sha256 feature too. That's probably not even a SemVer breaking change, since they're useless without it.

from elliptic-curves.

jedisct1 avatar jedisct1 commented on July 22, 2024

Yep, gating them would be useful, especially since the Rust error message doesn't really help understand the root cause.

from elliptic-curves.

tarcieri avatar tarcieri commented on July 22, 2024

sign_with_rng() also seems to be gone... Is that intentional?

That looks like an oversight

from elliptic-curves.

tarcieri avatar tarcieri commented on July 22, 2024

Here's a PR to gate the Signer and Verifier impls on sha256: #192

from elliptic-curves.

tarcieri avatar tarcieri commented on July 22, 2024

#193 adds a RandomizedSigner impl.

@jedisct1 can you try the latest master and see if it resolves your issues?

I'll also add some more documentation around the sha256 feature.

from elliptic-curves.

jedisct1 avatar jedisct1 commented on July 22, 2024

Looking good, thank you!

from elliptic-curves.

tarcieri avatar tarcieri commented on July 22, 2024

Will cut another release with these changes soon.

from elliptic-curves.

TheRealBluesun avatar TheRealBluesun commented on July 22, 2024

When I try using the keccak256 feature instead of sha256, I get this same error. Is this intended?

Basically I want to generate an Ethereum-friendly signature, which is keccak256. Any advice?

from elliptic-curves.

TheRealBluesun avatar TheRealBluesun commented on July 22, 2024

I resolved the issue by adding the following to k256/src/ecdsa.rs

#[cfg(all(feature = "ecdsa", feature = "keccak256"))]
impl ecdsa_core::hazmat::DigestPrimitive for Secp256k1 {
    type Digest = sha3::Keccak256;
}

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.