Why Nostr? What is Njump?
2024-07-29 16:57:26
in reply to

cloud fodder on Nostr: I asked claude about it, is it hallucinating? -> There seems to be a misunderstanding ...

I asked claude about it, is it hallucinating? ->

There seems to be a misunderstanding in that statement. Let me clarify how ECDH (Elliptic Curve Diffie-Hellman) key exchange works, particularly with respect to public key encoding:

In ECDH, the shared secret is computed based on one party's private key and the other party's public key. The result should be the same regardless of which party computes it.
The "02" or "03" prefix in a 33-byte compressed public key encoding doesn't affect the shared secret computation. Here's why:

The prefix (02 or 03) only indicates whether the y-coordinate of the public key point is even or odd.
When decompressing the public key, this prefix is used to reconstruct the full (x, y) coordinates of the point.
The actual ECDH computation uses the full (x, y) coordinates, not the compressed form.


The shared secret in ECDH is typically the x-coordinate of the resulting point from the scalar multiplication of one party's private key with the other party's public key point.
Whether you start with a "02" or "03" prefix, you'll end up with the same full (x, y) coordinates after decompression, and thus the same shared secret.

If you're experiencing different shared secrets based on the prefix, it could indicate an implementation error, possibly in the key decompression step or in the ECDH computation itself.
To ensure correct ECDH implementation:

Properly decompress the public key if it's in compressed format.
Use the full (x, y) coordinates for the ECDH computation.
Use only the x-coordinate of the resulting point as the shared secret.

If you're still encountering issues, it would be helpful to review the specific implementation or library you're using for ECDH computations.
Author Public Key
npub10npj3gydmv40m70ehemmal6vsdyfl7tewgvz043g54p0x23y0s8qzztl5h