<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://learn.equalit.ie/mw/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://learn.equalit.ie/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Arlolra</id>
		<title>learn.equalit.ie - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://learn.equalit.ie/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Arlolra"/>
		<link rel="alternate" type="text/html" href="https://learn.equalit.ie/wiki/Special:Contributions/Arlolra"/>
		<updated>2026-04-19T08:47:07Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.23.1</generator>

	<entry>
		<id>https://learn.equalit.ie/wiki/Np1sec/Specification</id>
		<title>Np1sec/Specification</title>
		<link rel="alternate" type="text/html" href="https://learn.equalit.ie/wiki/Np1sec/Specification"/>
				<updated>2014-10-21T18:25:20Z</updated>
		
		<summary type="html">&lt;p&gt;Arlolra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Procedures ==&lt;br /&gt;
&lt;br /&gt;
=== Chat setup ===&lt;br /&gt;
&lt;br /&gt;
====Chatroom setup====&lt;br /&gt;
&amp;lt;!--alg_chat_setup--&amp;gt;&lt;br /&gt;
{{algorithm-begin|name=Chatroom Init}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;newRoomName&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;participantNick&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;myId := 1&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;Nick_{myId} := participantNick&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;roomName := newRoomName&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;x_{myId}, y_{myId} :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Generate Initial Paramters&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;myId&amp;lt;/math&amp;gt;)&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;signatureKey_{myId} := (x_{myId},y_{myId})&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;participantList := [Nick_{myId}]&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;ephemeralPublicPointList := [y_{myId}, y_{other}]&amp;lt;/math&amp;gt;&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
=== Joining ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Join====&lt;br /&gt;
&amp;lt;!--alg_join--&amp;gt;&lt;br /&gt;
{{algorithm-begin|name=Join}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;newRoomName&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;Nickname_{myId}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;participantId&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;myId := participantId&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;roomName := newRoomName&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;x_{myId}, y_{myId} := &amp;lt;/math&amp;gt;&amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Generate Initial Paramters&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;myId&amp;lt;/math&amp;gt;)&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;signatureKey_{myId} := (x_{myId},y_{myId})&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Broadcast&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3Join:3&amp;quot;, &amp;lt;math&amp;gt;myId&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;Nickname_{myId}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;y_{myId}&amp;lt;/math&amp;gt;)&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;participantList, ephemeralPublicPointList :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Receive&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;sessionId := &amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Compute Session Id&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;roomName&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;participantList&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;ephemeralPublicPointList&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Sign and Send Key Confirmation and Shares&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Wait On Receive&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3KeyConfirmationShare:3&amp;quot;)&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;keyShareList, keyConfirmationList, signatureList :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Receive&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Verify Key Confirmations and Signatures&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;keyConfirmationList&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;signatureList&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Update Session Key&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Receive Session Digest}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;currentSessionHistoryDigest&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;sessionDigest := currentSessionHistoryDigest&amp;lt;/math&amp;gt;&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
====Protocol for other participants already in the chat to accept the newcomer====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--alg_accept--&amp;gt;&lt;br /&gt;
{{algorithm-begin|name=Accept}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;newParticipant&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Broadcast&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3Join:3&amp;quot;, &amp;lt;math&amp;gt;myId&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;Nickname_{myId}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;y_{myId}&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Wait On Receive&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3Join:3&amp;quot;)&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;nick_{NewParticipant}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;ephemeralPublicPoint_{NewParticipant} := &amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Receive&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Update Lists&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;nick_{NewParticipant}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;ephemeralPublicPoint_{NewParticipant}&amp;lt;/math&amp;gt;)&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;sessionId := &amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Compute Session Id&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;roomName&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;participantList&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;ephemeralPublicPointList&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Sign and Send Key Confirmation and Shares&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Wait On Receive&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3KeyConfirmationShare:3&amp;quot;)&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;keyShareList, keyConfirmationList, signatureList :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Receive&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Verify Key Confirmations and Signatures&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;keyConfirmationList&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;signatureList&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Update Session Key&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Send&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;sessionDigest&amp;lt;/math&amp;gt;)&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Leave ===&lt;br /&gt;
&lt;br /&gt;
====Farewell====&lt;br /&gt;
&amp;lt;!--alg_farewell--&amp;gt;&lt;br /&gt;
{{algorithm-begin|name=Shrink on Leave}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;leaverId&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''remove''' &amp;lt;math&amp;gt;leaverId&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;participantIdList&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;sessionId :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Compute Session Id&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   '''if''' &amp;lt;math&amp;gt;|participantList| &amp;gt; 1&amp;lt;/math&amp;gt;''', then'''&lt;br /&gt;
     &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Sign and Send Key Shares&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
     &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Wait On Receive&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3KeyShare:3&amp;quot;)&lt;br /&gt;
     &amp;lt;math&amp;gt;keyShareList&amp;lt;/math&amp;gt; := &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Receive&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
     &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Update Session Key&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;keyShareList&amp;lt;/math&amp;gt;)&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Sign and Send Key Shares}}&lt;br /&gt;
 Input: &lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;z_{myId -1, myId} := Hash(k_{myId,myId-1}, sessionId)&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;z_{myId, myId+1} := Hash(k_{myId,myId+1}, sessionId)&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;keyShare_{myId} := z_{myId -1, myId} \oplus z_{myId, myId+1}&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;originAuthSignature :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''ED25519Sign&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;SignatureKey&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;sessionId&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;z_{myId}&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Broadcast&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3KeyShare:3&amp;quot;, &amp;lt;math&amp;gt;myId&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;keyShare_{myId}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;originAuthSignature&amp;lt;/math&amp;gt;)  # we can send this encrypted but leaving person can read it, hence theoretically it is the same as sending it unencrypted.&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
====Send====&lt;br /&gt;
&amp;lt;!--alg_send--&amp;gt;&lt;br /&gt;
{{algorithm-begin|name=Send}}&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;metaMessage&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;message&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;keyShareMessage&amp;lt;/math&amp;gt; = &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''NewKeyShareMessage&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;metaMessage&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;math&amp;gt;cryptMessage&amp;lt;/math&amp;gt; := &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''AES CTR Encrypt&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;sessionKey&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;message | keyShareMessage&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;math&amp;gt;originAuthSignature&amp;lt;/math&amp;gt; := &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''ED25519Sign&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;SignatureKey&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;sessionId&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;cryptMetatMessage&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;math&amp;gt;sessionDigest&amp;lt;/math&amp;gt; := &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Compute Session Digest&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;lastMessage&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Broadcast&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3&amp;quot;, &amp;lt;math&amp;gt;sessionId&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;cryptMessage&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;sessionDigest&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;originAuthSignature&amp;lt;/math&amp;gt;,&amp;quot;:3&amp;quot;)&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
====Receive====&lt;br /&gt;
&amp;lt;!--alg_recv--&amp;gt;&lt;br /&gt;
{{algorithm-begin|name=Receive}}&lt;br /&gt;
Input: &amp;lt;math&amp;gt;sender&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;encryptedMessage&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;originAuthSignature&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;sessionDigest&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;v := &amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''ED25519VerifySignature&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;ephemeralPublicKeyList[Sender]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;sessionId || encryptedMessage&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;originAuthSignature&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Assert&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;) or '''return''' Reject&lt;br /&gt;
   &amp;lt;math&amp;gt;message, keyShareMessage :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''AES CTR Decrypt&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;sessionKey&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;encryptedMessage&amp;lt;/math&amp;gt;){}&lt;br /&gt;
   &amp;lt;math&amp;gt;isMetaMessage = &amp;lt;/math&amp;gt;&amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''UpdateNewKeyStatus&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;keyShareMessage&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Verify Digests&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;sessionDiges&amp;lt;/math&amp;gt;)&lt;br /&gt;
   '''return'''{&amp;lt;math&amp;gt;isMetaMessage, message&amp;lt;/math&amp;gt;}  # isMetaMessage is true if the message is purely meta message and there is nothing to display&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
=== Common functions ===&lt;br /&gt;
&lt;br /&gt;
====Common functions used by other procedures in different stages====&lt;br /&gt;
&amp;lt;!--alg_comm--&amp;gt;&lt;br /&gt;
{{algorithm-begin|name=Generate Initial Paramters}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;myId&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;signaturePrivateKey := &amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''RandomBits&amp;lt;/span&amp;gt;'''(256)&lt;br /&gt;
   &amp;lt;math&amp;gt;x_{myId} :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Ed25519 Scalar&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;signaturePrivateKey&amp;lt;/math&amp;gt;)) #{This is both Diffie-Hellman secret and ephemeral signature private key}&lt;br /&gt;
   &amp;lt;math&amp;gt;y_{myId} := x_{myId}P&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''return''' &amp;lt;math&amp;gt;x,y&amp;lt;/math&amp;gt;&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Verify Key Confirmation and Signatures}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;signatureList&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;keyConfirmationList&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''for each''' &amp;lt;math&amp;gt;participant \in participantList&amp;lt;/math&amp;gt;, '''do'''&lt;br /&gt;
     '''if''' &amp;lt;math&amp;gt;keyConfirmationList[participant][myId] \neq Hash(k_{myId,participant} , U_{myId} )&amp;lt;/math&amp;gt;''', then'''&lt;br /&gt;
       &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Halt&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
     '''else''' '''if''' &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''ED25519VerifySignature&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;ephemeralPublicKeyList[particicpant]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;sessionId | keyShares[myId]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;originAuthSignature&amp;lt;/math&amp;gt;) = Fail ''', then'''&lt;br /&gt;
       &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Halt&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Compute Session Id}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;participantList&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;ephemeralPublicPointList&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''return''' &amp;lt;math&amp;gt;Hash(roomName, zip(participantList, ephemeralPublicPointList))&amp;lt;/math&amp;gt;  # &amp;lt;math&amp;gt;zip([a,b],[c,d]):=[(a,c),(b,d)]&amp;lt;/math&amp;gt;&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Verify Signatures}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;longPublicList&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;schnorrRandomPointList&amp;lt;/math&amp;gt;, &lt;br /&gt;
 # standard signature verification&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Sign and Send Key Confirmation and Share}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;schnorrRandomPointList&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''for each''' &amp;lt;math&amp;gt;participant \in participantList&amp;lt;/math&amp;gt;, '''do'''&lt;br /&gt;
     &amp;lt;math&amp;gt;k_{myId, participant} := Hash(x_{myId}LP_{participant} |lp_{myId}y_{participant} | x_{myId}y_{participant})&amp;lt;/math&amp;gt;  # Triple DH&lt;br /&gt;
     &amp;lt;math&amp;gt;kc_{myId} := kc_{myId} | Hash(k_{myId,participant}, U_{participant})&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;z_{myId -1, myId} := Hash(k_{myId,myId-1}, sessionId)&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;z_{myId, myId+1} := Hash(k_{myId,myId+1}, sessionId)&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;keyShare_{myId} := z_{myId -1, myId} \oplus z_{myId, myId+1}&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;originAuthSignature :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''ED25519Sign&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;SignatureKey&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;sessionId&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;z_{myId}&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Broadcast&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3KeyConfirmationAndShare:3&amp;quot;, &amp;lt;math&amp;gt;myId&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;keyShare_{myId}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;originAuthSignature&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;kc_{myId}&amp;lt;/math&amp;gt;)&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Update Session Key}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;keyShareList&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;i := myId&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''for each''' &amp;lt;math&amp;gt;{j \in [i,...,i+n-1]}&amp;lt;/math&amp;gt;, '''do'''&lt;br /&gt;
      &amp;lt;math&amp;gt;z_{j,j+1} := z_{j-1,j} \oplus keyShareListe[j+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
     # recovered &amp;lt;math&amp;gt;z_{i-1,i}&amp;lt;/math&amp;gt; should be equal to its original value&lt;br /&gt;
    '''global''' &amp;lt;math&amp;gt;sessionKey := Hash(z_{j,j+1} | j \in [1...n])&amp;lt;/math&amp;gt;&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Sign Params Update Session Key}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;toBeSigned&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;signatureList&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;keyShareList&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Update Session Key&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   &amp;lt;math&amp;gt;toBeSigned := Hash(sessionId, ||Hash(verifierList, ephemeralPublicPointList, keyShareList)))&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;signature_{myId} := &amp;lt;/math&amp;gt;&amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Sign Session and Send&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;toBeSigned&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Broadcast&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3SignedSessionParameters:3&amp;quot;,&amp;lt;math&amp;gt;signature_{myId}&amp;lt;/math&amp;gt;)&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=ComputeSessionDigest}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;lastMessage&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''for each''' &amp;lt;math&amp;gt;message&amp;lt;/math&amp;gt; in Messages Received from &amp;lt;math&amp;gt;lastDigestedMessage&amp;lt;/math&amp;gt;+1 till &amp;lt;math&amp;gt;lastMessage&amp;lt;/math&amp;gt;, '''do'''&lt;br /&gt;
      &amp;lt;math&amp;gt;sesionDigest := Hash(sessionDigest, message)&amp;lt;/math&amp;gt; &lt;br /&gt;
      &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''LRU Cache Store Digest&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;sessionDigest&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;message&amp;lt;/math&amp;gt;)&lt;br /&gt;
   '''return''' &amp;lt;math&amp;gt;sessionDigest&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;lastMessageId&amp;lt;/math&amp;gt;&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=NewKeyShareMessage}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;metaMessage&amp;lt;/math&amp;gt;&lt;br /&gt;
 # Based on metaMessage Determines what type of keyshare needs to be send (Ephemeral point or Group key share) and returen it.&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=UpdateNewKeyStatus}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;keyShareMessage&amp;lt;/math&amp;gt;&lt;br /&gt;
 # Update the table of which participant has sent its new ephemeral point or its new group key share&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Hash}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;message&amp;lt;/math&amp;gt;&lt;br /&gt;
    '''return''' &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''SHA-256&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;message&amp;lt;/math&amp;gt;)&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
[[Category: mpOTR]]&lt;/div&gt;</summary>
		<author><name>Arlolra</name></author>	</entry>

	<entry>
		<id>https://learn.equalit.ie/wiki/Np1sec/Specification</id>
		<title>Np1sec/Specification</title>
		<link rel="alternate" type="text/html" href="https://learn.equalit.ie/wiki/Np1sec/Specification"/>
				<updated>2014-10-21T17:39:52Z</updated>
		
		<summary type="html">&lt;p&gt;Arlolra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Procedures ==&lt;br /&gt;
&lt;br /&gt;
=== Chat setup ===&lt;br /&gt;
&lt;br /&gt;
====Chatroom setup====&lt;br /&gt;
&amp;lt;!--alg_chat_setup--&amp;gt;&lt;br /&gt;
{{algorithm-begin|name=Chatroom Init}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;newRoomName&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;participantNick&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;myId := 1&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;Nick_{myId} := participantNick&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;roomName := newRoomName&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;x_{myId}, y_{myId} :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Generate Initial Paramters&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;myId&amp;lt;/math&amp;gt;)&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;signatureKey_{myId} := (x_{myId},y_{myId})&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;participantList := [Nick_{myId}]&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;ephemeralPublicPointList := [y_{myId}, y_{other}]&amp;lt;/math&amp;gt;&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
=== Joining ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Join====&lt;br /&gt;
&amp;lt;!--alg_join--&amp;gt;&lt;br /&gt;
{{algorithm-begin|name=Join}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;newRoomName&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;Nickname_{myId}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;participantId&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;myId := participantId&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;roomName := newRoomName&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;x_{myId}, y_{myId} := &amp;lt;/math&amp;gt;&amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Generate Initial Paramters&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;myId&amp;lt;/math&amp;gt;)&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;signatureKey_{myId} := (x_{myId},y_{myId})&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Broadcast&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3Join:3&amp;quot;, &amp;lt;math&amp;gt;myId&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;Nickname_{myId}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;y_{myId}&amp;lt;/math&amp;gt;)&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;participantList, ephemeralPublicPointList :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Receive&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;sessionId := &amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Compute Session Id&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;roomName&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;participantList&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;ephemeralPublicPointList&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Sign and Send Key Confirmation and Shares&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Wait On Receive&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3KeyConfirmationShare:3&amp;quot;)&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;keyShareList, keyConfirmationList, signatureList :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Receive&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Verify Key Confirmations and Signatures&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;keyConfirmationList&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;signatureList&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Update Session Key&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Receive Session Digest}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;currentSessionHistoryDigest&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;sessionDigest := currentSessionHistoryDigest&amp;lt;/math&amp;gt;&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
====Protocol for other participants already in the chat to accept the newcomer====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--alg_accept--&amp;gt;&lt;br /&gt;
{{algorithm-begin|name=Accept}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;newParticipant&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Broadcast&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3Join:3&amp;quot;, &amp;lt;math&amp;gt;myId&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;Nickname_{myId}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;y_{myId}&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Wait On Receive&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3Join:3&amp;quot;)&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;nick_{NewParticipant}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;ephemeralPublicPoint_{NewParticipant} := &amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Receive&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Update Lists&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;nick_{NewParticipant}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;ephemeralPublicPoint_{NewParticipant}&amp;lt;/math&amp;gt;)&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;sessionId := &amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Compute Session Id&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;roomName&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;participantList&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;ephemeralPublicPointList&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Sign and Send Key Confirmation and Shares&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Wait On Receive&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3KeyConfirmationShare:3&amp;quot;)&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;keyShareList, keyConfirmationList, signatureList :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Receive&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Verify Key Confirmations and Signatures&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;keyConfirmationList&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;signatureList&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Update Session Key&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Send&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;sessionDigest&amp;lt;/math&amp;gt;)&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Leave ===&lt;br /&gt;
&lt;br /&gt;
====Farewell====&lt;br /&gt;
&amp;lt;!--alg_farewell--&amp;gt;&lt;br /&gt;
{{algorithm-begin|name=Shrink on Leave}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;leaverId&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''remove''' &amp;lt;math&amp;gt;leaverId&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;participantIdList&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;sessionId :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Compute Session Id&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   '''if''' &amp;lt;math&amp;gt;|participantList| &amp;gt; 1&amp;lt;/math&amp;gt;''', then'''&lt;br /&gt;
     &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Sign and Send Key Shares&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
     &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Wait On Receive&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3KeyShare:3&amp;quot;)&lt;br /&gt;
     &amp;lt;math&amp;gt;keyShareList&amp;lt;/math&amp;gt; := &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Receive&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
     &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Update Session Key&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;keyShareList&amp;lt;/math&amp;gt;)&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Sign and Send Key Shares}}&lt;br /&gt;
 Input: &lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;z_{myId -1, myId} := Hash(k_{myId,myId-1}, sessionId)&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;z_{myId, myId+1} := Hash(k_{myId,myId+1}, sessionId)&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;keyShare_{myId} := z_{myId -1, myId} \oplus z_{myId, myId+1}&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;originAuthSignature :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''ED25519Sign&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;SignatureKey&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;sessionId&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;z_{myId}&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Broadcast&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3KeyShare:3&amp;quot;, &amp;lt;math&amp;gt;myId&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;keyShare_{myId}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;originAuthSignature&amp;lt;/math&amp;gt;)  # we can send this encrypted but leaving person can read it, hence theoretically it is the same as sending it unencrypted.&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
====Send====&lt;br /&gt;
&amp;lt;!--alg_send--&amp;gt;&lt;br /&gt;
{{algorithm-begin|name=Send}}&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;metaMessage&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;message&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;keyShareMessage&amp;lt;/math&amp;gt; = &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''NewKeyShareMessage&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;metaMessage&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;math&amp;gt;cryptMessage&amp;lt;/math&amp;gt; := &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''AES CTR Encrypt&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;sessionKey&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;message | keyShareMessage&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;math&amp;gt;originAuthSignature&amp;lt;/math&amp;gt; := &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''ED25519Sign&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;SignatureKey&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;sessionId&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;cryptMetatMessage&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;math&amp;gt;sessionDigest&amp;lt;/math&amp;gt; := &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Compute Session Digest&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;lastMessage&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Broadcast&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3&amp;quot;, &amp;lt;math&amp;gt;sessionId&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;cryptMessage&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;sessionDigest&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;originAuthSignature&amp;lt;/math&amp;gt;,&amp;quot;:3&amp;quot;)&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
====Receive====&lt;br /&gt;
&amp;lt;!--alg_recv--&amp;gt;&lt;br /&gt;
{{algorithm-begin|name=Receive}}&lt;br /&gt;
Input: &amp;lt;math&amp;gt;sender&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;encryptedMessage&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;originAuthSignature&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;sessionDigest&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;v := &amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''ED25519VerifySignature&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;ephemeralPublicKeyList[Sender]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;sessionId || encryptedMessage&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;originAuthSignature&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Assert&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;) or '''return''' Reject&lt;br /&gt;
   &amp;lt;math&amp;gt;message, keyShareMessage :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''AES CTR Decrypt&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;sessionKey&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;encryptedMessage&amp;lt;/math&amp;gt;){}&lt;br /&gt;
   &amp;lt;math&amp;gt;isMetaMessage = &amp;lt;/math&amp;gt;&amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''UpdateNewKeyStatus&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;keyShareMessage&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Verify Digests&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;sessionDiges&amp;lt;/math&amp;gt;)&lt;br /&gt;
   '''return'''{&amp;lt;math&amp;gt;isMetaMessage, message&amp;lt;/math&amp;gt;}  # isMetaMessage is true if the message is purely meta message and there is nothing to display&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
=== Common functions ===&lt;br /&gt;
&lt;br /&gt;
====Common functions used by other procedures in different stages====&lt;br /&gt;
&amp;lt;!--alg_comm--&amp;gt;&lt;br /&gt;
{{algorithm-begin|name=Generate Initial Paramters}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;myId&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;signaturePrivateKey := &amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''RandomBits&amp;lt;/span&amp;gt;'''(256)&lt;br /&gt;
   &amp;lt;math&amp;gt;x_{myId} :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Ed25519 Scalar&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;signaturePrivateKey&amp;lt;/math&amp;gt;)) #{This is both Diffie-Hellman secret and ephemeral signature private key}&lt;br /&gt;
   &amp;lt;math&amp;gt;y_{myId} := x_{myId}P&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''return''' &amp;lt;math&amp;gt;x,y&amp;lt;/math&amp;gt;&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Verify Key Confirmation and Signatures}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;signatureList&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;keyConfirmationList&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''for each''' &amp;lt;math&amp;gt;participant \in participantList&amp;lt;/math&amp;gt;, '''do'''&lt;br /&gt;
     '''if''' &amp;lt;math&amp;gt;keyConfirmationList[participant][myId] \neq Hash(k_{myId,participant} , U_{myId} )&amp;lt;/math&amp;gt;''', then'''&lt;br /&gt;
       &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Halt&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
     '''else''' '''if''' &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''ED25519VerifySignature&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;ephemeralPublicKeyList[particicpant]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;sessionId | keyShares[myId]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;originAuthSignature&amp;lt;/math&amp;gt;) = Fail ''', then'''&lt;br /&gt;
       &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Halt&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Compute Session Id}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;participantList&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;ephemeralPublicPointList&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''return''' &amp;lt;math&amp;gt;Hash(roomName, zip(participantList, ephemeralPublicPointList))&amp;lt;/math&amp;gt;  # &amp;lt;math&amp;gt;zip([a,b],[c,d]):=[(a,c),(b,d)]&amp;lt;/math&amp;gt;&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Verify Signatures}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;longPublicList&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;schnorrRandomPointList&amp;lt;/math&amp;gt;, &lt;br /&gt;
 # standard signature verification&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Sign and Send Key Confirmation and Share}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;schnorrRandomPointList&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''for each''' &amp;lt;math&amp;gt;participant \in participantList&amp;lt;/math&amp;gt;, '''do'''&lt;br /&gt;
     &amp;lt;math&amp;gt;k_{myId, participant} := Hash(x_{myId}LP_{participant} |lp_{myId}y_{participant} | x_{myId}y_{participant})&amp;lt;/math&amp;gt;  # Triple DH&lt;br /&gt;
     &amp;lt;math&amp;gt;kc_{myId} := kc_{myId} | Hash(k_{myId,participant}, U_{participant})&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;z_{myId -1, myId} := Hash(k_{myId,myId-1}, sessionId)&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''global''' &amp;lt;math&amp;gt;z_{myId, myId+1} := Hash(k_{myId,myId+1}, sessionId)&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;keyShare_{myId} := z_{myId -1, myId} \oplus z_{myId, myId+1}&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;originAuthSignature :=&amp;lt;/math&amp;gt; &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''ED25519Sign&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;SignatureKey&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;sessionId&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;z_{myId}&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Broadcast&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3KeyConfirmationAndShare:3&amp;quot;, &amp;lt;math&amp;gt;myId&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;keyShare_{myId}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;originAuthSignature&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;kc_{myId}&amp;lt;/math&amp;gt;)&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Update Session Key}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;keyShareList&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;i := myId&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''for each''' &amp;lt;math&amp;gt;{j \in [i,...,i+n-1]}&amp;lt;/math&amp;gt;, '''do'''&lt;br /&gt;
      &amp;lt;math&amp;gt;z_{j,j+1} := z_{j-1,j} \oplus keyShareListe[j+1]&amp;lt;/math&amp;gt;&lt;br /&gt;
     # recovered &amp;lt;math&amp;gt;z_{i-1,i}&amp;lt;/math&amp;gt; should be equal to its original value&lt;br /&gt;
    '''global''' &amp;lt;math&amp;gt;sessionKey := Hash(z_{j,j+1} | j \in [1...n])&amp;lt;/math&amp;gt;&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Sign Params Update Session Key}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;toBeSigned&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;signatureList&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;keyShareList&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Update Session Key&amp;lt;/span&amp;gt;'''()&lt;br /&gt;
   &amp;lt;math&amp;gt;toBeSigned := Hash(sessionId, ||Hash(verifierList, ephemeralPublicPointList, keyShareList)))&amp;lt;/math&amp;gt;&lt;br /&gt;
   &amp;lt;math&amp;gt;signature_{myId} := &amp;lt;/math&amp;gt;&amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Sign Session and Send&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;toBeSigned&amp;lt;/math&amp;gt;)&lt;br /&gt;
   &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''Broadcast&amp;lt;/span&amp;gt;'''(&amp;quot;:3mpCAT:3SignedSessionParameters:3&amp;quot;,&amp;lt;math&amp;gt;signature_{myId}&amp;lt;/math&amp;gt;)&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=ComputeSessionDigest}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;lastMessage&amp;lt;/math&amp;gt;&lt;br /&gt;
   '''for each''' &amp;lt;math&amp;gt;message&amp;lt;/math&amp;gt; in Messages Received from &amp;lt;math&amp;gt;lastDigestedMessage&amp;lt;/math&amp;gt;+1 till &amp;lt;math&amp;gt;lastMessage&amp;lt;/math&amp;gt;, '''do'''&lt;br /&gt;
      &amp;lt;math&amp;gt;sesionDigest := Hash(sessionDigest, message)&amp;lt;/math&amp;gt; &lt;br /&gt;
      &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''LRU Cache Store Digest&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;sessionDigest&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;message&amp;lt;/math&amp;gt;)&lt;br /&gt;
   '''return''' &amp;lt;math&amp;gt;sessionDigest&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;lastMessageId&amp;lt;/math&amp;gt;&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=NewKeyShareMessage}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;metaMessage&amp;lt;/math&amp;gt;&lt;br /&gt;
 # Based on metaMessage Determines what type of keyshare needs to be send (Ephemeral point or Group key share) and returen it.&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=UpdateNewKeyStatus}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;keyShareMessage&amp;lt;/math&amp;gt;&lt;br /&gt;
 # Update the table of which participant has sent its new ephemeral point or its new group key share&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{algorithm-begin|name=Hash}}&lt;br /&gt;
 Input: &amp;lt;math&amp;gt;message&amp;lt;/math&amp;gt;&lt;br /&gt;
    '''return''' &amp;lt;span style=&amp;quot;font-family: serif; font-size: larger; font-variant:small-caps;&amp;quot;&amp;gt;'''SHA-512&amp;lt;/span&amp;gt;'''(&amp;lt;math&amp;gt;message&amp;lt;/math&amp;gt;)&lt;br /&gt;
{{algorithm-end}}&lt;br /&gt;
&lt;br /&gt;
[[Category: mpOTR]]&lt;/div&gt;</summary>
		<author><name>Arlolra</name></author>	</entry>

	</feed>