# How to Formalize Noise Protocol Messages

I try to understand the messages of the Noise Protocol Framework. The handshakes are based on Diffie-Hellmann key exchange. This is an example for a handshake pattern:

-> e
<- e, ee, s, es


I try to formalize the handshake with mathematical descriptions. For example the mathematical description of the first message is: . Where is a generator and is the private ephemeral key of the sender. But I don't understand how the values ee and es are calculated. How can these patterns be descriebed mathematically?

ee and es aren't values, they're function invocations.

ee denotes the use of a Diffie-Hellman key exchange using two ephemeral keys, es denotes the use of a Diffie-Hellman key exchange using an ephemeral key and a static key. The first letter is the initiator, the second is the responder.

So it's just $$ee = DH(e, re)$$, $$es=DH(e,rs)$$, $$se = DH(s, re)$$, $$ss = DH(s, rs)$$, where $$DH(i,r)$$ is the Diffie-Hellman exchange function applied to the $$i$$nitiator's key and the $$r$$espoder's key.