CodesInChaos / Chaos.NaCl

Chaos.NaCl cryptography library
Other
131 stars 54 forks source link

ge_double_scalarmult #16

Open Syyn926 opened 4 years ago

Syyn926 commented 4 years ago

So I want to do a point multiplication on a Ed25519 curve and I used the function in the title because that's the only one that accepts a specific point input. I set my scalar to a and my point to A and b is a scalar of zeros. From my understanding of the b*B part of the equation should result with the point [0,1]. When this is added to my a*A, it should not have any effect on the point yet I'm seeing a a difference of 0x80 in the last byte of the encoded result when compared to another known good source.

On a side note, there's a ed25519.py library that handles a case for a zero scalar input which automatically returns [0,1] and I couldn't tell if this was happening in the above function. It makes sense the function wouldn't handle this edge case scenario of a zero scalar input because that doesn't make sense in the verify portion of EdDSA, yet I'm trying to leverage this function to perform a point multiplication with a scalar and a specified point.

Any help with this issue would be greatly appreciated. My understanding of ed25519 curves is minimal, but I'm trying to perform a Diffie-Hellman key exchange using the Ed25519 curve.