Skip to content

Conversation

@mdqst
Copy link

@mdqst mdqst commented Sep 14, 2025

No description provided.

Copy link
Contributor

@jonasnick jonasnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mdqst, I'm pretty sure that the current ECDH example code produces the same shared secret for both parties. This is tested in CI and I just double checked locally.

@mdqst

This comment was marked as resolved.

@jonasnick
Copy link
Contributor

The default hash function in libsecp256k1 always hashed the compressed representation of the point. So you want to change libsecp's example to match your code?

Note that outputting the X-coordinate directly can lead to vulnerabilities because the resulting shared secret is easily distinguishable from uniform randomness (and potentially enables "Cheon's attack").

@mdqst mdqst requested a review from jonasnick September 15, 2025 07:12
@jonasnick
Copy link
Contributor

jonasnick commented Sep 15, 2025

Now you're outputting the X-coordinates of both participants' public keys (and remove a bunch of documentation comments). Why?

@mdqst mdqst closed this Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants