What is Nostr?
Phantasm /
npub1er2…arq5
2025-03-03 21:25:56
in reply to nevent1q…a239

Phantasm on Nostr: meso Well, the "magic" part of the whole exchange is that when you calculate a power ...

meso (nprofile…gx4l) Well, the "magic" part of the whole exchange is that when you calculate a power of a number that already was a power of something, you can replace it with a something to the power of the two variables multiplied.

pub: g (small prime), n (big prime)
priv: a (alice secret), b (bob secret)
calc:
- alice: g^a modulo n (sent to bob)
- bob: g^b modulo n (sent to alice)
- "magic" part:
- alice: (g^a)^b modulo n; which can be simplified to g^(a * b)
- bob: (g^b)^a modulo n; which can be simplified to g^(b * a)

Now it's obvious that you exchanged a shared secret without disclosing your secrets with a few numbers

These days it's usually done with elliptic curves, but the math still works work almost the same. Instead of powers and modulo, you have an equation for an elliptic curve and multiply a public "position" one of you determined on the curve by your secrets, scrap the Y axis and send the multiplied position (at least that's the way I think it works). Instead of solving the discrete log problem, you are solving the elliptic curve discrete log problem.
Author Public Key
npub1er26g8v2gdquxkyk43usmlk7gaqhle08p378ld3ldfd6p5yrt8usmfarq5