Diffie–Hellman key exchange
Start with a number that both sides know. Call it the shared secret.
Each side picks their own private secret number.
Multiply private numbers by the shared numbers.
Exchange the products.
Multiply by the private secret.
Your numbers match, allowing you to verify each other's identity.
And you never had to reveal your secret to one another.