Update content of files

This commit is contained in:
GitHub Action 2023-08-07 12:53:15 +00:00
parent 650683b6d5
commit 52d4404db9
3 changed files with 230 additions and 226 deletions

View file

@ -47,26 +47,28 @@
<p>Lots of Telegram API methods provide access to potentially large lists of objects, which requires pagination.</p>
<p>In order to fetch only relevant subset of results for each request there is a number of available input parameters. Here is a list in order how they are applied in API.</p>
<p>Typically, results are returned in reverse chronological order with descending object ID values.</p>
<h3><a class="anchor" name="limit-parameter" href="#limit-parameter"><i class="anchor-icon"></i></a><code>limit</code> parameter</h3>
<h3><a class="anchor" href="#limit-parameter" id="limit-parameter" name="limit-parameter"><i class="anchor-icon"></i></a><code>limit</code> parameter</h3>
<p>A limit on the number of objects to be returned, typically between 1 and 100. When 0 is provided the limit will often default to an intermediate value like ~20.</p>
<h3><a class="anchor" name="offset-based-pagination" href="#offset-based-pagination"><i class="anchor-icon"></i></a><code>offset</code>-based pagination</h3>
<h3><a class="anchor" href="#offset-based-pagination" id="offset-based-pagination" name="offset-based-pagination"><i class="anchor-icon"></i></a><code>offset</code>-based pagination</h3>
<p>For a few methods with mostly static data this parameter allows to skip <code>offset</code> elements from the beginning of list; negative values are ignored.</p>
<h3><a class="anchor" name="offset-id-based-pagination" href="#offset-id-based-pagination"><i class="anchor-icon"></i></a><code>offset_id</code>-based pagination</h3>
<h3><a class="anchor" href="#offset-id-based-pagination" id="offset-id-based-pagination" name="offset-id-based-pagination"><i class="anchor-icon"></i></a><code>offset_id</code>-based pagination</h3>
<p>For most methods where results are real-time data (e.g. any chat history) <code>offset</code> value is not passed directly. Instead it is calculated from the passed <code>offset_id</code> and <code>add_offset</code> parameter values as <code>offsetFromID(offset_id) + add_offset</code>, where <code>offsetFromID(offset_id)</code> is a number of results from the beginning of list up to the result with ID <code>offset_id</code>, inclusive.</p>
<p>Sample use cases:</p>
<ul>
<li>Loading 20 messages, older than message with ID <code>MSGID</code>:</li>
<li>
<p>Loading 20 messages, older than message with ID <code>MSGID</code>:</p>
<p>messages.getHistory({offset_id: MSGID, add_offset: 0, limit: 20})</p>
</li>
<li>
<p>Loading 20 messages, newer than message with ID <code>MSGID</code>:</p>
<p>messages.getHistory({offset_id: MSGID, add_offset: -20, limit: 20})</p>
</li>
<li>
<p>Loading 20 messages around message with ID <code>MSGID</code>:</p>
<p>messages.getHistory({offset_id: MSGID, add_offset: -10, limit: 20})</p>
</li>
</ul>
<pre><code>messages.getHistory({offset_id: MSGID, add_offset: 0, limit: 20})</code></pre>
<ul>
<li>Loading 20 messages, newer than message with ID <code>MSGID</code>:</li>
</ul>
<pre><code>messages.getHistory({offset_id: MSGID, add_offset: -20, limit: 20})</code></pre>
<ul>
<li>Loading 20 messages around message with ID <code>MSGID</code>:</li>
</ul>
<pre><code>messages.getHistory({offset_id: MSGID, add_offset: -10, limit: 20})</code></pre>
<h3><a class="anchor" name="additional-filtering" href="#additional-filtering"><i class="anchor-icon"></i></a>Additional filtering</h3>
<h3><a class="anchor" href="#additional-filtering" id="additional-filtering" name="additional-filtering"><i class="anchor-icon"></i></a>Additional filtering</h3>
<p>There is a number of parameters, which are applied to the list after slicing with offset and limit, to reduce the result subset even more:</p>
<ul>
<li><strong>max_id</strong>: Can be used to only return results with ID strictly smaller than <code>max_id</code> (e.g. message ID)</li>
@ -75,8 +77,8 @@
<li><strong>min_date</strong>: Can be used to only return results with are newer than <code>min_date</code>:</li>
<li><strong>hash</strong>: See below.</li>
</ul>
<h3><a class="anchor" name="hash-generation" href="#hash-generation"><i class="anchor-icon"></i></a>Hash generation</h3>
<p>To further reduce the result subset, there is a mechanism to avoid fetching data if the resulting list hasn&#39;t changed from the one stored on client, similar to <a href="https://en.wikipedia.org/wiki/HTTP_ETag">ETag</a>.</p>
<h3><a class="anchor" href="#hash-generation" id="hash-generation" name="hash-generation"><i class="anchor-icon"></i></a>Hash generation</h3>
<p>To further reduce the result subset, there is a mechanism to avoid fetching data if the resulting list hasn't changed from the one stored on client, similar to <a href="https://en.wikipedia.org/wiki/HTTP_ETag">ETag</a>.</p>
<p>When the client has cached results for API request, it can calculate the <code>hash</code> value for it by taking the result IDs (message IDs or other fields with name <code>id</code>) and using them to compute a 64-bit hash with the following algorithm:</p>
<pre><code># Here, ^ indicates a bitwise XOR
@ -88,12 +90,11 @@ for id in ids:
hash = hash + id</code></pre>
<p>In some cases, the result container already has a <code>hash</code> field, that can be used instead.</p>
<p>When the client passes a correct value, the API will return one of <code>*NotModified</code> constructors, e.g. <a href="/constructor/messages.messagesNotModified">messages.messagesNotModified</a> instead of the actual results.</p>
<h3><a class="anchor" name="example-methods" href="#example-methods"><i class="anchor-icon"></i></a>Example methods</h3>
<h3><a class="anchor" href="#example-methods" id="example-methods" name="example-methods"><i class="anchor-icon"></i></a>Example methods</h3>
<ul>
<li><a href="/method/messages.getHistory">messages.getHistory</a> supports all result navigation parameters including message ID hashes and except filters</li>
<li><a href="/method/channels.getParticipants">channels.getParticipants</a> supports simple navigation using <strong>limit</strong> and <strong>offset</strong>, along with filtering and <code>hash</code> reducing using the user IDs of returned participants</li>
</ul>
</div>
</ul></div>
</div>

View file

@ -136,7 +136,10 @@
<td>The master DC did not accept the <code>request_token</code> from the CDN DC. Continue downloading the file from the master DC using upload.getFile.</td>
</tr>
</tbody>
</table></div>
</table>
<h3><a class="anchor" href="#testing-cdn-redirects" id="testing-cdn-redirects" name="testing-cdn-redirects"><i class="anchor-icon"></i></a>Testing CDN redirects</h3>
<p>You may test CDN file redirects by logging into the <a href="/api/auth#test-accounts">test DCs</a> with a DC 2 account (phone number <code>999662YYYY</code>, where YYYY are random numbers, login code <code>22222</code>), uploading and then redownloading the uploaded file. </p>
<p>Make sure the chosen test account doesn't have a Telegram Premium test subscription, as CDN file downloads are disabled on the test DCs if a Telegram Premium test subscription is enabled (you can check this by making sure the <a href="/constructor/user">user</a> returned by a <a href="/method/users.getUsers">users.getUsers</a> call with <a href="/constructor/inputUserSelf">inputUserSelf</a> does not have the <code>premium</code> flag set).</p></div>
</div>

View file

@ -53,9 +53,9 @@
<h5><a class="anchor" href="#1-client-sends-query-to-server" id="1-client-sends-query-to-server" name="1-client-sends-query-to-server"><i class="anchor-icon"></i></a>1) Client sends query to server</h5>
<!-- start req_pq_multi -->
<p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 D4 A8 0E 00 2E 14 BD 64
0010 | 14 00 00 00 F1 8E 7E BE 8E 5F 16 4A 0C 6B 62 63
0020 | 47 92 D9 A2 43 3E AC 5C</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 E8 90 02 00 F0 E5 D0 64
0010 | 14 00 00 00 F1 8E 7E BE FA 56 B8 81 4A 7D 8A 03
0020 | EF 19 33 5E 6B 08 91 F0</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;</code></pre>
<table class="table">
@ -77,7 +77,7 @@
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>D4A80E002E14BD64</code></td>
<td><code>E8900200F0E5D064</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
@ -95,7 +95,7 @@
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>8E5F164A0C6B62634792D9A2433EAC5C</code></td>
<td><code>FA56B8814A7D8A03EF19335E6B0891F0</code></td>
<td>Random number</td>
</tr>
</tbody>
@ -104,11 +104,11 @@
<h5><a class="anchor" href="#2-server-sends-response-of-the-form" id="2-server-sends-response-of-the-form" name="2-server-sends-response-of-the-form"><i class="anchor-icon"></i></a>2) Server sends response of the form</h5>
<!-- start resPQ -->
<p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 E0 CB D7 2E 14 BD 64
0010 | A0 00 00 00 63 24 16 05 8E 5F 16 4A 0C 6B 62 63
0020 | 47 92 D9 A2 43 3E AC 5C FE 23 5C 20 EB 66 2B E4
0030 | 8E D2 C1 3C 79 3D 50 9C 08 1C 80 7A AA 22 BE D9
0040 | E5 00 00 00 15 C4 B5 1C 03 00 00 00 A5 B7 F7 09
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 28 CA A4 F0 E5 D0 64
0010 | 6C 00 00 00 63 24 16 05 FA 56 B8 81 4A 7D 8A 03
0020 | EF 19 33 5E 6B 08 91 F0 DB 9F E2 2A 93 C1 07 45
0030 | 08 DE 79 17 1E 18 50 CE 08 1C 84 51 C9 6B 32 C2
0040 | FD 00 00 00 15 C4 B5 1C 03 00 00 00 A5 B7 F7 09
0050 | 35 5F C3 0B 21 6B E8 6C 02 2B B4 C3 85 FD 64 DE
0060 | 85 1D 9D D0</code></pre>
<p>Payload (de)serialization:</p>
@ -132,13 +132,13 @@
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>01E0CBD72E14BD64</code></td>
<td><code>0128CAA4F0E5D064</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
<td>message_length</td>
<td>16, 4</td>
<td><code>A0000000</code> (160 in decimal)</td>
<td><code>6C000000</code> (108 in decimal)</td>
<td>Message body length</td>
</tr>
<tr>
@ -150,19 +150,19 @@
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>8E5F164A0C6B62634792D9A2433EAC5C</code></td>
<td><code>FA56B8814A7D8A03EF19335E6B0891F0</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>FE235C20EB662BE48ED2C13C793D509C</code></td>
<td><code>DB9FE22A93C1074508DE79171E1850CE</code></td>
<td>Server-generated random number</td>
</tr>
<tr>
<td>pq</td>
<td>56, 12</td>
<td><code>081C807AAA22BED9E5000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 2053776301226908133</td>
<td><code>081C8451C96B32C2FD000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 2054857255516553981</td>
<td>Single-byte prefix denoting length, an 8-byte string, and three bytes of padding</td>
</tr>
<tr>
@ -208,22 +208,22 @@
<h4><a class="anchor" href="#proof-of-work" id="proof-of-work" name="proof-of-work"><i class="anchor-icon"></i></a>Proof of work</h4>
<h5><a class="anchor" href="#3-client-decomposes-pq-into-prime-factors-such-that-p--q" id="3-client-decomposes-pq-into-prime-factors-such-that-p--q" name="3-client-decomposes-pq-into-prime-factors-such-that-p--q"><i class="anchor-icon"></i></a>3) Client decomposes pq into prime factors such that p &lt; q.</h5>
<!-- start pq -->
<pre><code>pq = 2053776301226908133</code></pre>
<p>Decompose into 2 prime cofactors <code>p &lt; q</code>: <code>2053776301226908133 = 1121131069 * 1831878857</code></p>
<pre><code>p = 1121131069
q = 1831878857</code></pre>
<pre><code>pq = 2054857255516553981</code></pre>
<p>Decompose into 2 prime cofactors <code>p &lt; q</code>: <code>2054857255516553981 = 1103058367 * 1862872643</code></p>
<pre><code>p = 1103058367
q = 1862872643</code></pre>
<!-- end pq -->
<h4><a class="anchor" href="#presenting-proof-of-work-server-authentication" id="presenting-proof-of-work-server-authentication" name="presenting-proof-of-work-server-authentication"><i class="anchor-icon"></i></a>Presenting proof of work; Server authentication</h4>
<h5><a class="anchor" href="#4-encrypted-data-payload-generation" id="4-encrypted-data-payload-generation" name="4-encrypted-data-payload-generation"><i class="anchor-icon"></i></a>4) <code>encrypted_data</code> payload generation</h5>
<p>First of all, generate an <code>encrypted_data</code> payload as follows:</p>
<!-- start p_q_inner_data_dc -->
<p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 95 5F F5 A9 08 1C 80 7A AA 22 BE D9 E5 00 00 00
0010 | 04 42 D3 1A 3D 00 00 00 04 6D 30 40 C9 00 00 00
0020 | 8E 5F 16 4A 0C 6B 62 63 47 92 D9 A2 43 3E AC 5C
0030 | FE 23 5C 20 EB 66 2B E4 8E D2 C1 3C 79 3D 50 9C
0040 | 24 62 30 E0 F7 4C 3B 30 6D 14 55 BE 80 8E 51 15
0050 | C3 83 B4 53 C1 05 90 F5 F1 BC 06 A3 92 F4 53 AE
<pre><code>0000 | 95 5F F5 A9 08 1C 84 51 C9 6B 32 C2 FD 00 00 00
0010 | 04 41 BF 55 BF 00 00 00 04 6F 09 2E 43 00 00 00
0020 | FA 56 B8 81 4A 7D 8A 03 EF 19 33 5E 6B 08 91 F0
0030 | DB 9F E2 2A 93 C1 07 45 08 DE 79 17 1E 18 50 CE
0040 | 27 1F FA 94 F7 6D D9 A1 B8 44 D2 3B 1F 14 66 C8
0050 | E6 8F 61 D4 48 8A CA E8 20 1A E5 70 84 27 5C B8
0060 | 02 00 00 00</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>p_q_inner_data_dc#a9f55f95 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data;</code></pre>
@ -246,37 +246,37 @@ q = 1831878857</code></pre>
<tr>
<td>pq</td>
<td>4, 12</td>
<td><code>081C807AAA22BED9E5000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 2053776301226908133</td>
<td><code>081C8451C96B32C2FD000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 2054857255516553981</td>
<td>Single-byte prefix denoting length, 8-byte string, and three bytes of padding</td>
</tr>
<tr>
<td>p</td>
<td>16, 8</td>
<td><code>0442D31A3D000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1121131069</td>
<td><code>0441BF55BF000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1103058367</td>
<td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr>
<tr>
<td>q</td>
<td>24, 8</td>
<td><code>046D3040C9000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1831878857</td>
<td><code>046F092E43000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1862872643</td>
<td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr>
<tr>
<td>nonce</td>
<td>32, 16</td>
<td><code>8E5F164A0C6B62634792D9A2433EAC5C</code></td>
<td><code>FA56B8814A7D8A03EF19335E6B0891F0</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>48, 16</td>
<td><code>FE235C20EB662BE48ED2C13C793D509C</code></td>
<td><code>DB9FE22A93C1074508DE79171E1850CE</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>new_nonce</td>
<td>64, 32</td>
<td><code>246230E0F74C3B306D1455BE808E5115</code> <code>C383B453C10590F5F1BC06A392F453AE</code></td>
<td><code>271FFA94F76DD9A1B844D23B1F1466C8</code> <code>E68F61D4488ACAE8201AE57084275CB8</code></td>
<td>Client-generated random number</td>
</tr>
<tr>
@ -291,39 +291,39 @@ q = 1831878857</code></pre>
<p>The serialization of <em>P_Q_inner_data</em> produces <strong>data</strong>, which is used to generate <strong>encrypted_data</strong> as specified in <a href="/mtproto/auth_key">step 4.1</a>.<br>
These are the inputs to the algorithm specified in <a href="/mtproto/auth_key">step 4.1</a>:</p>
<!-- start p_q_inner_data_input -->
<pre><code>data = 955FF5A9081C807AAA22BED9E50000000442D31A3D000000046D3040C90000008E5F164A0C6B62634792D9A2433EAC5CFE235C20EB662BE48ED2C13C793D509C246230E0F74C3B306D1455BE808E5115C383B453C10590F5F1BC06A392F453AE02000000
random_padding_bytes = D8C2D66723BF8F092A2418648093840A780CA68C813B7C9483DA6DE69CF837169BA442C0DDD6D6C78996180264C84FDA86DB11FFC9B0BB468838AE2B66D7E30074BBF5F03F447D742FA3D3FB8C2386424811E3DDC176FB862128FAFA</code></pre>
<pre><code>data = 955FF5A9081C8451C96B32C2FD0000000441BF55BF000000046F092E43000000FA56B8814A7D8A03EF19335E6B0891F0DB9FE22A93C1074508DE79171E1850CE271FFA94F76DD9A1B844D23B1F1466C8E68F61D4488ACAE8201AE57084275CB802000000
random_padding_bytes = 982FF8E0583964DDDE33C21862E923F799A0768BB0D0BF2B7DCE86A965E5085B46CF8C0023A8AAE9EF6D6F033C08790577FB305E7492ABD99266C1A04481EE08FED2565698114E49565BE749BF90143A35E48A139E0B01DA47552605</code></pre>
<!-- end p_q_inner_data_input -->
<p>And this is the output:</p>
<!-- start p_q_inner_data_output -->
<pre><code>encrypted_data = 5BC3252F8978A35583A450936F32CADF16E7D245869BB3B882FB7A9B8117836F046C6C5F59ECC9038A5FCB8BAB8F13ACE5159E1CC09E2155C86C9E436AB17E3830EADAB050CD1370AA016A84B50BCA8E65BB7B982CC74641387B38AB81368F256ECAE971CB023BEB33609FD05949E5F0FE53B40AADD403A024FC2F3FBC0F23C2E0682F44BB9A922C3E932BB40694E10CFF6EF9C155522C77C6C920E7296E6616DD4D060F026DBB94559CF84CB92C9B465C8FE3211E2E884ED7A7E6EA49B88DD04CCB61017EF276CE28AD0B8A3EC2843DDC58133D07F7B4AACF7BD0B1AFC8C6DA8C044B80210E384A0B0E4D52F602288B68520F57A40D4D177D16B4BDEA5A7342</code></pre>
<pre><code>encrypted_data = CBCC221B7089C4A33B6B85318CDB8430FBEA9A6753941B7A8173773A58E42B9BA76B2ABFBD0AB244D9F797EA524CF404F2E7B87BB54D51253EAD3B6F8BF9DC1823A963B78A3F4F0146132FFC33FE54708E98766F0356C1E7722BD69877981F7FA8F62ADC8A2FB16CD6C19474F6DE14F7245397A0CB378ECFCD785789B9E3BC1B4B369F5A95BBE3E8FC1F4D184AF9C7CFCC019CD6A8A9EC9D3DB50C6E0E2358F2D947EE062FA5ED120CA94E8B95961CD2F4BF1FB2E53B660A6E6B02C2C88188B39C577EB07231723EE35118DCEB5F72C200A6A1F27F46C8665EE6412D2869DD8FF8DDB55A0010FD45D96C27A3F505C1300B4FE51619B48D183E7F969D8691D021</code></pre>
<!-- end p_q_inner_data_output -->
<p>The length of the final string is 256 bytes.</p>
<h5><a class="anchor" href="#5-send-req-dh-params-query-with-generated-encrypted-data" id="5-send-req-dh-params-query-with-generated-encrypted-data" name="5-send-req-dh-params-query-with-generated-encrypted-data"><i class="anchor-icon"></i></a>5) Send req_DH_params query with generated <code>encrypted_data</code></h5>
<!-- start req_DH_params -->
<p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 D8 A8 0E 00 2E 14 BD 64
0010 | 40 01 00 00 BE E4 12 D7 8E 5F 16 4A 0C 6B 62 63
0020 | 47 92 D9 A2 43 3E AC 5C FE 23 5C 20 EB 66 2B E4
0030 | 8E D2 C1 3C 79 3D 50 9C 04 42 D3 1A 3D 00 00 00
0040 | 04 6D 30 40 C9 00 00 00 85 FD 64 DE 85 1D 9D D0
0050 | FE 00 01 00 5B C3 25 2F 89 78 A3 55 83 A4 50 93
0060 | 6F 32 CA DF 16 E7 D2 45 86 9B B3 B8 82 FB 7A 9B
0070 | 81 17 83 6F 04 6C 6C 5F 59 EC C9 03 8A 5F CB 8B
0080 | AB 8F 13 AC E5 15 9E 1C C0 9E 21 55 C8 6C 9E 43
0090 | 6A B1 7E 38 30 EA DA B0 50 CD 13 70 AA 01 6A 84
00A0 | B5 0B CA 8E 65 BB 7B 98 2C C7 46 41 38 7B 38 AB
00B0 | 81 36 8F 25 6E CA E9 71 CB 02 3B EB 33 60 9F D0
00C0 | 59 49 E5 F0 FE 53 B4 0A AD D4 03 A0 24 FC 2F 3F
00D0 | BC 0F 23 C2 E0 68 2F 44 BB 9A 92 2C 3E 93 2B B4
00E0 | 06 94 E1 0C FF 6E F9 C1 55 52 2C 77 C6 C9 20 E7
00F0 | 29 6E 66 16 DD 4D 06 0F 02 6D BB 94 55 9C F8 4C
0100 | B9 2C 9B 46 5C 8F E3 21 1E 2E 88 4E D7 A7 E6 EA
0110 | 49 B8 8D D0 4C CB 61 01 7E F2 76 CE 28 AD 0B 8A
0120 | 3E C2 84 3D DC 58 13 3D 07 F7 B4 AA CF 7B D0 B1
0130 | AF C8 C6 DA 8C 04 4B 80 21 0E 38 4A 0B 0E 4D 52
0140 | F6 02 28 8B 68 52 0F 57 A4 0D 4D 17 7D 16 B4 BD
0150 | EA 5A 73 42</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 C4 55 0E 00 F0 E5 D0 64
0010 | 40 01 00 00 BE E4 12 D7 FA 56 B8 81 4A 7D 8A 03
0020 | EF 19 33 5E 6B 08 91 F0 DB 9F E2 2A 93 C1 07 45
0030 | 08 DE 79 17 1E 18 50 CE 04 41 BF 55 BF 00 00 00
0040 | 04 6F 09 2E 43 00 00 00 85 FD 64 DE 85 1D 9D D0
0050 | FE 00 01 00 CB CC 22 1B 70 89 C4 A3 3B 6B 85 31
0060 | 8C DB 84 30 FB EA 9A 67 53 94 1B 7A 81 73 77 3A
0070 | 58 E4 2B 9B A7 6B 2A BF BD 0A B2 44 D9 F7 97 EA
0080 | 52 4C F4 04 F2 E7 B8 7B B5 4D 51 25 3E AD 3B 6F
0090 | 8B F9 DC 18 23 A9 63 B7 8A 3F 4F 01 46 13 2F FC
00A0 | 33 FE 54 70 8E 98 76 6F 03 56 C1 E7 72 2B D6 98
00B0 | 77 98 1F 7F A8 F6 2A DC 8A 2F B1 6C D6 C1 94 74
00C0 | F6 DE 14 F7 24 53 97 A0 CB 37 8E CF CD 78 57 89
00D0 | B9 E3 BC 1B 4B 36 9F 5A 95 BB E3 E8 FC 1F 4D 18
00E0 | 4A F9 C7 CF CC 01 9C D6 A8 A9 EC 9D 3D B5 0C 6E
00F0 | 0E 23 58 F2 D9 47 EE 06 2F A5 ED 12 0C A9 4E 8B
0100 | 95 96 1C D2 F4 BF 1F B2 E5 3B 66 0A 6E 6B 02 C2
0110 | C8 81 88 B3 9C 57 7E B0 72 31 72 3E E3 51 18 DC
0120 | EB 5F 72 C2 00 A6 A1 F2 7F 46 C8 66 5E E6 41 2D
0130 | 28 69 DD 8F F8 DD B5 5A 00 10 FD 45 D9 6C 27 A3
0140 | F5 05 C1 30 0B 4F E5 16 19 B4 8D 18 3E 7F 96 9D
0150 | 86 91 D0 21</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params;</code></pre>
<table class="table">
@ -345,7 +345,7 @@ random_padding_bytes = D8C2D66723BF8F092A2418648093840A780CA68C813B7C9483DA6DE69
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>D8A80E002E14BD64</code></td>
<td><code>C4550E00F0E5D064</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
@ -363,25 +363,25 @@ random_padding_bytes = D8C2D66723BF8F092A2418648093840A780CA68C813B7C9483DA6DE69
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>8E5F164A0C6B62634792D9A2433EAC5C</code></td>
<td><code>FA56B8814A7D8A03EF19335E6B0891F0</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>FE235C20EB662BE48ED2C13C793D509C</code></td>
<td><code>DB9FE22A93C1074508DE79171E1850CE</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>p</td>
<td>56, 8</td>
<td><code>0442D31A3D000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1121131069</td>
<td><code>0441BF55BF000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1103058367</td>
<td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr>
<tr>
<td>q</td>
<td>64, 8</td>
<td><code>046D3040C9000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1831878857</td>
<td><code>046F092E43000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1862872643</td>
<td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr>
<tr>
@ -393,7 +393,7 @@ random_padding_bytes = D8C2D66723BF8F092A2418648093840A780CA68C813B7C9483DA6DE69
<tr>
<td>encrypted_data</td>
<td>80, 260</td>
<td><code>FE0001005BC3252F8978A35583A45093</code> <code>6F32CADF16E7D245869BB3B882FB7A9B</code> <code>8117836F046C6C5F59ECC9038A5FCB8B</code> <code>AB8F13ACE5159E1CC09E2155C86C9E43</code> <code>6AB17E3830EADAB050CD1370AA016A84</code> <code>B50BCA8E65BB7B982CC74641387B38AB</code> <code>81368F256ECAE971CB023BEB33609FD0</code> <code>5949E5F0FE53B40AADD403A024FC2F3F</code> <code>BC0F23C2E0682F44BB9A922C3E932BB4</code> <code>0694E10CFF6EF9C155522C77C6C920E7</code> <code>296E6616DD4D060F026DBB94559CF84C</code> <code>B92C9B465C8FE3211E2E884ED7A7E6EA</code> <code>49B88DD04CCB61017EF276CE28AD0B8A</code> <code>3EC2843DDC58133D07F7B4AACF7BD0B1</code> <code>AFC8C6DA8C044B80210E384A0B0E4D52</code> <code>F602288B68520F57A40D4D177D16B4BD</code><br> <code>EA5A7342</code></td>
<td><code>FE000100CBCC221B7089C4A33B6B8531</code> <code>8CDB8430FBEA9A6753941B7A8173773A</code> <code>58E42B9BA76B2ABFBD0AB244D9F797EA</code> <code>524CF404F2E7B87BB54D51253EAD3B6F</code> <code>8BF9DC1823A963B78A3F4F0146132FFC</code> <code>33FE54708E98766F0356C1E7722BD698</code> <code>77981F7FA8F62ADC8A2FB16CD6C19474</code> <code>F6DE14F7245397A0CB378ECFCD785789</code> <code>B9E3BC1B4B369F5A95BBE3E8FC1F4D18</code> <code>4AF9C7CFCC019CD6A8A9EC9D3DB50C6E</code> <code>0E2358F2D947EE062FA5ED120CA94E8B</code> <code>95961CD2F4BF1FB2E53B660A6E6B02C2</code> <code>C88188B39C577EB07231723EE35118DC</code> <code>EB5F72C200A6A1F27F46C8665EE6412D</code> <code>2869DD8FF8DDB55A0010FD45D96C27A3</code> <code>F505C1300B4FE51619B48D183E7F969D</code><br> <code>8691D021</code></td>
<td>Value generated above</td>
</tr>
</tbody>
@ -402,47 +402,47 @@ random_padding_bytes = D8C2D66723BF8F092A2418648093840A780CA68C813B7C9483DA6DE69
<h5><a class="anchor" href="#6-server-responds-with" id="6-server-responds-with" name="6-server-responds-with"><i class="anchor-icon"></i></a>6) Server responds with:</h5>
<!-- start server_DH_params_ok -->
<p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 AC 30 79 2F 14 BD 64
0010 | A8 02 00 00 5C 07 E8 D0 8E 5F 16 4A 0C 6B 62 63
0020 | 47 92 D9 A2 43 3E AC 5C FE 23 5C 20 EB 66 2B E4
0030 | 8E D2 C1 3C 79 3D 50 9C FE 50 02 00 9A D5 42 1A
0040 | 13 6A 4C F5 E7 E2 56 F9 DF ED 61 C1 70 66 5F F7
0050 | 0E D7 48 AE 53 2C A3 1F 6D 77 21 AB 8A D3 E5 B0
0060 | D1 C3 D1 BE EF 5D FE DB F3 FE 8C C6 CC C3 77 7C
0070 | 2D 02 7C D4 41 A2 0B DC 85 BE 70 75 D3 C4 AB 1C
0080 | 99 92 7D 63 89 4B DB 4F B2 23 48 EF D2 DD 0B 95
0090 | 17 B5 7E 21 C6 57 9C 1F D6 BC A0 DD DD 7F 17 8E
00A0 | B1 5F AC 08 79 A7 5B AB 6A 4A C1 38 DA 5A C9 5B
00B0 | 88 91 5F 03 98 1C EE BC 75 DC A7 C9 8B 12 72 84
00C0 | F1 AE BF 79 B0 F7 2B 80 FF 49 39 CA 8D 68 20 AA
00D0 | E5 7C 45 39 28 CF 26 3C BC E8 51 E8 C0 30 63 C6
00E0 | A4 8C 4D 46 B9 0D F9 2D 68 20 5D 5E FC C8 20 67
00F0 | 78 81 00 52 28 B2 3E EE B2 D5 CF 70 27 D9 3D BC
0100 | D4 A5 18 4C CE 5A 33 90 4E 33 5A 00 9A 39 3F 1D
0110 | 4B A1 D3 1D 21 1E 55 D8 11 D0 9E 48 B4 63 3E B8
0120 | DE 26 BD DB 33 47 94 FD 6C 7B E7 F7 1C 42 73 F0
0130 | 00 DE 89 56 2B 30 08 1A 5C E0 BC AC 99 9C EF E2
0140 | 3A 64 01 CF B1 32 09 D4 31 E6 BF 8B AD B2 D5 C5
0150 | 2C CE 21 0E 8F 2D 5E 01 82 4B DF B6 69 38 EA F7
0160 | FE B7 D6 12 BB 7D F4 A2 54 E8 A6 F9 FF D7 A8 70
0170 | 5F A0 11 32 8F EC 82 1D 88 22 2B F3 18 9D DA 79
0180 | A2 8E A8 13 46 50 31 B3 25 44 44 A4 48 ED 57 0B
0190 | B9 0E 73 03 2B 81 48 5B E1 19 22 BD 1C 23 46 B5
01A0 | C5 21 0E F5 B0 44 DA 4C A5 88 08 F5 E8 C5 AA 5E
01B0 | 32 C8 9C C3 9F 3B 8F E8 09 2C B4 F1 0F 3D 4D 08
01C0 | FD 7D 21 D2 49 AB 1D 8F ED FD 89 7D 27 38 3B 00
01D0 | 0D 01 C9 14 CF D8 58 7D B8 AF A3 0F 99 FA 7C 87
01E0 | 16 EB 79 F0 71 0B 72 AE B5 97 73 A1 FB 66 ED 24
01F0 | 3C 0D 3F 48 38 AE 5A 09 ED F6 A9 A9 08 6E 86 B3
0200 | 36 29 E3 32 28 E8 1D FE 6E 21 CC E3 E7 32 6A 0B
0210 | 1E 9B A4 D4 49 F6 2B 4F C5 84 5F 96 52 9E F6 A9
0220 | 94 22 53 0F 18 DC 65 6B 8D 85 57 28 4C 9C AD DA
0230 | 57 CD 68 F6 A2 97 6D C6 A9 C1 3F 8A 70 13 51 7A
0240 | F5 7F 96 7E 21 A7 40 41 E8 2A B8 21 EC 63 3B 8F
0250 | DA CA 0F D0 D2 CC 58 0B FA 5B 3D 9C 66 8B DC 22
0260 | 12 95 8F A2 44 C4 40 77 23 56 D9 ED 1C 25 33 E0
0270 | 9D 26 E7 60 F7 E9 48 4E D1 2D 3D 25 C6 83 A8 41
0280 | 97 3C D7 0D BA 12 C1 91 6B 74 E8 81</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 D0 B5 45 F1 E5 D0 64
0010 | 7C 02 00 00 5C 07 E8 D0 FA 56 B8 81 4A 7D 8A 03
0020 | EF 19 33 5E 6B 08 91 F0 DB 9F E2 2A 93 C1 07 45
0030 | 08 DE 79 17 1E 18 50 CE FE 50 02 00 54 05 70 19
0040 | A0 F5 84 77 B6 7F 75 BF D4 8C FC E2 4D 13 F5 A4
0050 | D6 3D 29 2C 92 56 59 93 B8 29 B6 C6 81 93 A3 19
0060 | 7E 06 91 43 02 09 FF 4D 9D 7F E6 E2 FF FB 3E FF
0070 | 5C C9 14 A2 21 97 DF ED D6 39 55 8E 4B A4 98 66
0080 | 7A B1 FB 93 D1 1E D7 E5 D8 00 5E 74 5F 70 74 30
0090 | 6E 44 B9 80 56 18 7D AE EE 10 31 C4 F9 4D 6F 83
00A0 | 1C 98 98 A6 02 1D 37 84 A9 34 CD 3F 35 B1 EA 75
00B0 | 3D E0 14 C6 74 5C 37 75 B7 92 AD 09 83 79 09 CA
00C0 | 38 56 AB 99 CB D2 FA 92 EE B1 F8 86 05 04 CD 97
00D0 | BA 1D 2B 87 CD CA 4A C1 28 BB AF AB A1 85 33 10
00E0 | 7F A9 00 D2 56 13 1C F2 06 D3 A4 B1 83 4B 71 45
00F0 | D3 6E 70 E3 02 4F A2 7E 86 A6 55 AC AD 41 5B F8
0100 | 24 C9 7A A1 59 C4 14 2D 40 D0 F9 9C 89 3C AC DB
0110 | 15 1B B3 32 96 ED BA D8 F1 13 F0 46 53 BA 60 42
0120 | DB F4 98 E5 5F 82 D0 CB B8 1E 24 FB 46 24 6B F3
0130 | 98 8F 30 4F 69 D5 A8 10 98 15 0D FA EE D7 1F A7
0140 | E9 37 56 EE 19 50 6A EB 4D 0A B4 F2 E9 29 DB 8F
0150 | CB 5F 0D D9 70 DC E3 AD 98 73 5C 5D 9E 9A 49 E9
0160 | 01 14 30 11 5C E7 3F 3C 9A 33 C0 52 92 9D 33 EE
0170 | E2 09 24 C9 D1 AC AF 0C 13 00 50 10 C9 F3 86 FD
0180 | 02 D1 64 9F BC 6A A7 5F 6A 53 24 31 10 94 1E 60
0190 | 99 D7 77 D9 F4 49 DC E8 EA 01 1E A2 39 1C 1E CF
01A0 | F6 AF FA BA 51 2D 45 0B F6 79 6E F1 43 CB 85 78
01B0 | 31 82 37 CC 24 87 86 DD 26 FE 1A 26 3D B8 A7 38
01C0 | B1 8B BD 19 0A C3 F9 DD 37 9C 34 70 7D 74 3A CF
01D0 | D3 00 19 EF 80 DD 38 20 34 40 5A BB 22 69 42 4A
01E0 | 62 E2 60 98 CC 40 02 88 7D D8 04 E2 71 4D A8 3F
01F0 | 7C C7 48 37 5C A2 CF 53 A0 5B E5 FD 85 1C 38 9E
0200 | DF 36 17 37 DD 61 EC 1A E7 17 6B F8 3F 2E FD 1A
0210 | 10 92 A6 B5 4C 44 6A CA 66 FA 37 27 28 7E 12 B4
0220 | 00 70 7F 2B DD 2B 36 26 C3 FC F6 27 35 4B C1 C9
0230 | DA 93 8F 39 06 17 CA E1 35 46 9B 16 8B C6 36 3C
0240 | EF 42 28 C5 8C 2C 7E 37 F6 F6 C4 B6 7B 5D 95 57
0250 | AE EE 93 4C 1C 1E A0 EB F9 0A 23 17 90 DF 1A F0
0260 | 5C D2 2F 83 57 C5 F6 FD 43 17 48 7C 19 74 3D BD
0270 | AD 7B B1 AB 03 37 30 EB A8 61 2F 59 6F 2A 34 01
0280 | 8B CA DF 83 77 7A B9 79 4B 65 AC 5A</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;</code></pre>
<table class="table">
@ -464,13 +464,13 @@ random_padding_bytes = D8C2D66723BF8F092A2418648093840A780CA68C813B7C9483DA6DE69
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>01AC30792F14BD64</code></td>
<td><code>01D0B545F1E5D064</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
<td>message_length</td>
<td>16, 4</td>
<td><code>A8020000</code> (680 in decimal)</td>
<td><code>7C020000</code> (636 in decimal)</td>
<td>Message body length</td>
</tr>
<tr>
@ -482,19 +482,19 @@ random_padding_bytes = D8C2D66723BF8F092A2418648093840A780CA68C813B7C9483DA6DE69
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>8E5F164A0C6B62634792D9A2433EAC5C</code></td>
<td><code>FA56B8814A7D8A03EF19335E6B0891F0</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>FE235C20EB662BE48ED2C13C793D509C</code></td>
<td><code>DB9FE22A93C1074508DE79171E1850CE</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>encrypted_answer</td>
<td>56, 596</td>
<td><code>FE5002009AD5421A136A4CF5E7E256F9</code> <code>DFED61C170665FF70ED748AE532CA31F</code> <code>6D7721AB8AD3E5B0D1C3D1BEEF5DFEDB</code> <code>F3FE8CC6CCC3777C2D027CD441A20BDC</code> <code>85BE7075D3C4AB1C99927D63894BDB4F</code> <code>B22348EFD2DD0B9517B57E21C6579C1F</code> <code>D6BCA0DDDD7F178EB15FAC0879A75BAB</code> <code>6A4AC138DA5AC95B88915F03981CEEBC</code> <code>75DCA7C98B127284F1AEBF79B0F72B80</code> <code>FF4939CA8D6820AAE57C453928CF263C</code> <code>BCE851E8C03063C6A48C4D46B90DF92D</code> <code>68205D5EFCC820677881005228B23EEE</code> <code>B2D5CF7027D93DBCD4A5184CCE5A3390</code> <code>4E335A009A393F1D4BA1D31D211E55D8</code> <code>11D09E48B4633EB8DE26BDDB334794FD</code> <code>6C7BE7F71C4273F000DE89562B30081A</code> <code>5CE0BCAC999CEFE23A6401CFB13209D4</code> <code>31E6BF8BADB2D5C52CCE210E8F2D5E01</code> <code>824BDFB66938EAF7FEB7D612BB7DF4A2</code> <code>54E8A6F9FFD7A8705FA011328FEC821D</code> <code>88222BF3189DDA79A28EA813465031B3</code> <code>254444A448ED570BB90E73032B81485B</code> <code>E11922BD1C2346B5C5210EF5B044DA4C</code> <code>A58808F5E8C5AA5E32C89CC39F3B8FE8</code> <code>092CB4F10F3D4D08FD7D21D249AB1D8F</code> <code>EDFD897D27383B000D01C914CFD8587D</code> <code>B8AFA30F99FA7C8716EB79F0710B72AE</code> <code>B59773A1FB66ED243C0D3F4838AE5A09</code> <code>EDF6A9A9086E86B33629E33228E81DFE</code> <code>6E21CCE3E7326A0B1E9BA4D449F62B4F</code> <code>C5845F96529EF6A99422530F18DC656B</code> <code>8D8557284C9CADDA57CD68F6A2976DC6</code> <code>A9C13F8A7013517AF57F967E21A74041</code> <code>E82AB821EC633B8FDACA0FD0D2CC580B</code> <code>FA5B3D9C668BDC2212958FA244C44077</code> <code>2356D9ED1C2533E09D26E760F7E9484E</code> <code>D12D3D25C683A841973CD70DBA12C191</code><br> <code>6B74E881</code></td>
<td><code>FE50020054057019A0F58477B67F75BF</code> <code>D48CFCE24D13F5A4D63D292C92565993</code> <code>B829B6C68193A3197E0691430209FF4D</code> <code>9D7FE6E2FFFB3EFF5CC914A22197DFED</code> <code>D639558E4BA498667AB1FB93D11ED7E5</code> <code>D8005E745F7074306E44B98056187DAE</code> <code>EE1031C4F94D6F831C9898A6021D3784</code> <code>A934CD3F35B1EA753DE014C6745C3775</code> <code>B792AD09837909CA3856AB99CBD2FA92</code> <code>EEB1F8860504CD97BA1D2B87CDCA4AC1</code> <code>28BBAFABA18533107FA900D256131CF2</code> <code>06D3A4B1834B7145D36E70E3024FA27E</code> <code>86A655ACAD415BF824C97AA159C4142D</code> <code>40D0F99C893CACDB151BB33296EDBAD8</code> <code>F113F04653BA6042DBF498E55F82D0CB</code> <code>B81E24FB46246BF3988F304F69D5A810</code> <code>98150DFAEED71FA7E93756EE19506AEB</code> <code>4D0AB4F2E929DB8FCB5F0DD970DCE3AD</code> <code>98735C5D9E9A49E9011430115CE73F3C</code> <code>9A33C052929D33EEE20924C9D1ACAF0C</code> <code>13005010C9F386FD02D1649FBC6AA75F</code> <code>6A53243110941E6099D777D9F449DCE8</code> <code>EA011EA2391C1ECFF6AFFABA512D450B</code> <code>F6796EF143CB8578318237CC248786DD</code> <code>26FE1A263DB8A738B18BBD190AC3F9DD</code> <code>379C34707D743ACFD30019EF80DD3820</code> <code>34405ABB2269424A62E26098CC400288</code> <code>7DD804E2714DA83F7CC748375CA2CF53</code> <code>A05BE5FD851C389EDF361737DD61EC1A</code> <code>E7176BF83F2EFD1A1092A6B54C446ACA</code> <code>66FA3727287E12B400707F2BDD2B3626</code> <code>C3FCF627354BC1C9DA938F390617CAE1</code> <code>35469B168BC6363CEF4228C58C2C7E37</code> <code>F6F6C4B67B5D9557AEEE934C1C1EA0EB</code> <code>F90A231790DF1AF05CD22F8357C5F6FD</code> <code>4317487C19743DBDAD7BB1AB033730EB</code> <code>A8612F596F2A34018BCADF83777AB979</code><br> <code>4B65AC5A</code></td>
<td>See below</td>
</tr>
</tbody>
@ -502,20 +502,20 @@ random_padding_bytes = D8C2D66723BF8F092A2418648093840A780CA68C813B7C9483DA6DE69
<!-- end server_DH_params_ok -->
<p>Decrypt <code>encrypted_answer</code> using the reverse of the process specified in <a href="/mtproto/auth_key#6-server-responds-with">step 6</a>:</p>
<!-- start server_DH_inner_data_input -->
<pre><code>encrypted_answer = 9AD5421A136A4CF5E7E256F9DFED61C170665FF70ED748AE532CA31F6D7721AB8AD3E5B0D1C3D1BEEF5DFEDBF3FE8CC6CCC3777C2D027CD441A20BDC85BE7075D3C4AB1C99927D63894BDB4FB22348EFD2DD0B9517B57E21C6579C1FD6BCA0DDDD7F178EB15FAC0879A75BAB6A4AC138DA5AC95B88915F03981CEEBC75DCA7C98B127284F1AEBF79B0F72B80FF4939CA8D6820AAE57C453928CF263CBCE851E8C03063C6A48C4D46B90DF92D68205D5EFCC820677881005228B23EEEB2D5CF7027D93DBCD4A5184CCE5A33904E335A009A393F1D4BA1D31D211E55D811D09E48B4633EB8DE26BDDB334794FD6C7BE7F71C4273F000DE89562B30081A5CE0BCAC999CEFE23A6401CFB13209D431E6BF8BADB2D5C52CCE210E8F2D5E01824BDFB66938EAF7FEB7D612BB7DF4A254E8A6F9FFD7A8705FA011328FEC821D88222BF3189DDA79A28EA813465031B3254444A448ED570BB90E73032B81485BE11922BD1C2346B5C5210EF5B044DA4CA58808F5E8C5AA5E32C89CC39F3B8FE8092CB4F10F3D4D08FD7D21D249AB1D8FEDFD897D27383B000D01C914CFD8587DB8AFA30F99FA7C8716EB79F0710B72AEB59773A1FB66ED243C0D3F4838AE5A09EDF6A9A9086E86B33629E33228E81DFE6E21CCE3E7326A0B1E9BA4D449F62B4FC5845F96529EF6A99422530F18DC656B8D8557284C9CADDA57CD68F6A2976DC6A9C13F8A7013517AF57F967E21A74041E82AB821EC633B8FDACA0FD0D2CC580BFA5B3D9C668BDC2212958FA244C440772356D9ED1C2533E09D26E760F7E9484ED12D3D25C683A841973CD70DBA12C1916B74E881
tmp_aes_key = ED0582A5A37DC51D44A48A3DB9BDE1BDA036E0883025EA375501EDB2CD8E19F0
tmp_aes_iv = D5646AAAEABD85D919B9FABFB922A5F55031EECBF9A4E95A9F28C2DA246230E0</code></pre>
<pre><code>encrypted_answer = 54057019A0F58477B67F75BFD48CFCE24D13F5A4D63D292C92565993B829B6C68193A3197E0691430209FF4D9D7FE6E2FFFB3EFF5CC914A22197DFEDD639558E4BA498667AB1FB93D11ED7E5D8005E745F7074306E44B98056187DAEEE1031C4F94D6F831C9898A6021D3784A934CD3F35B1EA753DE014C6745C3775B792AD09837909CA3856AB99CBD2FA92EEB1F8860504CD97BA1D2B87CDCA4AC128BBAFABA18533107FA900D256131CF206D3A4B1834B7145D36E70E3024FA27E86A655ACAD415BF824C97AA159C4142D40D0F99C893CACDB151BB33296EDBAD8F113F04653BA6042DBF498E55F82D0CBB81E24FB46246BF3988F304F69D5A81098150DFAEED71FA7E93756EE19506AEB4D0AB4F2E929DB8FCB5F0DD970DCE3AD98735C5D9E9A49E9011430115CE73F3C9A33C052929D33EEE20924C9D1ACAF0C13005010C9F386FD02D1649FBC6AA75F6A53243110941E6099D777D9F449DCE8EA011EA2391C1ECFF6AFFABA512D450BF6796EF143CB8578318237CC248786DD26FE1A263DB8A738B18BBD190AC3F9DD379C34707D743ACFD30019EF80DD382034405ABB2269424A62E26098CC4002887DD804E2714DA83F7CC748375CA2CF53A05BE5FD851C389EDF361737DD61EC1AE7176BF83F2EFD1A1092A6B54C446ACA66FA3727287E12B400707F2BDD2B3626C3FCF627354BC1C9DA938F390617CAE135469B168BC6363CEF4228C58C2C7E37F6F6C4B67B5D9557AEEE934C1C1EA0EBF90A231790DF1AF05CD22F8357C5F6FD4317487C19743DBDAD7BB1AB033730EBA8612F596F2A34018BCADF83777AB9794B65AC5A
tmp_aes_key = 2254F20E901881266F49CA54E3BD0A187375A0440D8E90D69FA30C4FB4414477
tmp_aes_iv = D0D2643702C4C19E178AE141ACC6C2DF87CD0C761E8B13EC361296D1271FFA94</code></pre>
<!-- end server_DH_inner_data_input -->
<p>Yielding:</p>
<!-- start server_DH_inner_data_output -->
<pre><code>answer_with_hash = 25489064474896343C19122637D8FE5A7A846D64BA0D89B58E5F164A0C6B62634792D9A2433EAC5CFE235C20EB662BE48ED2C13C793D509C03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE000100B64E75C04088ED0DF30F06C46CDDB48E9E93516BB5A95ED45853D0D5E6391335F5EAE0C95773DCBB2CFDAD9991B4A361DB987C20B61D2A82DFE890ED723E61A46AD3ABA8A69D0AE919F38FA2F452A49B60A8740F4A0F14E0C8FDB8453CE75A0A9D3D22ACEA3E56D95D5E0657FB91C89AE9F9939A0F884D09FE9DC6D0AD3C704318ABD27B95F8C92E2C726D0DA4F406CBF3FBC18BD3D0ECF1AB6163D0DCD25FA8339B298283AEDBA4B322CB4CD384D27088DA94418FC8438A6AFE9758E660D9EF600B34ABC521D4994F0D34ADBC2E969AD59B73C4F1F53BCA585F7195B4746ACB70DC66ABA8B47B65518E4EB0EE2B4F06CB98AA72B51751178D456EBC3C3573982F14BD6493F6FBEFB93195F7
answer = BA0D89B58E5F164A0C6B62634792D9A2433EAC5CFE235C20EB662BE48ED2C13C793D509C03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE000100B64E75C04088ED0DF30F06C46CDDB48E9E93516BB5A95ED45853D0D5E6391335F5EAE0C95773DCBB2CFDAD9991B4A361DB987C20B61D2A82DFE890ED723E61A46AD3ABA8A69D0AE919F38FA2F452A49B60A8740F4A0F14E0C8FDB8453CE75A0A9D3D22ACEA3E56D95D5E0657FB91C89AE9F9939A0F884D09FE9DC6D0AD3C704318ABD27B95F8C92E2C726D0DA4F406CBF3FBC18BD3D0ECF1AB6163D0DCD25FA8339B298283AEDBA4B322CB4CD384D27088DA94418FC8438A6AFE9758E660D9EF600B34ABC521D4994F0D34ADBC2E969AD59B73C4F1F53BCA585F7195B4746ACB70DC66ABA8B47B65518E4EB0EE2B4F06CB98AA72B51751178D456EBC3C3573982F14BD6493F6FBEFB93195F7</code></pre>
<pre><code>answer_with_hash = B9E1266C58E205B9B57041114999ADC56DBD01C3BA0D89B5FA56B8814A7D8A03EF19335E6B0891F0DB9FE22A93C1074508DE79171E1850CE03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE00010067E90A8C787B0B939B8C4E40B5B694938842786B75DB893DFF4D309A10C3FE9323C063C053A4DC2F50381FBC841CD9221C4403DADCC7C76B642435810CB145526784A1C4D7A6825755948CF8F2E581C12A7B24667E7B98CD4335C82530CFB42A0D090C441CF9AECCADA3068DD869DDB8585E4512828FB27175975884529157EFC1EBAF7B5BAC7870551CD8EB717695C4D2CAFB71C4B152D2D1A76264F1A8EF9139CF74FE945F150356BF24C057C10B9DD482CD9460BA8E8533F3AD389F0185DF7C8930F664A5C6EB0EFB552FC7D1315C9DDD3F7A1013E9A4B3C41C572AE0577C2F5E4D17196C6C7423028BF5A43A589A53A53B3E99699F3A13F5121D9F961445F1E5D06421F9AE252BE3F26B
answer = BA0D89B5FA56B8814A7D8A03EF19335E6B0891F0DB9FE22A93C1074508DE79171E1850CE03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE00010067E90A8C787B0B939B8C4E40B5B694938842786B75DB893DFF4D309A10C3FE9323C063C053A4DC2F50381FBC841CD9221C4403DADCC7C76B642435810CB145526784A1C4D7A6825755948CF8F2E581C12A7B24667E7B98CD4335C82530CFB42A0D090C441CF9AECCADA3068DD869DDB8585E4512828FB27175975884529157EFC1EBAF7B5BAC7870551CD8EB717695C4D2CAFB71C4B152D2D1A76264F1A8EF9139CF74FE945F150356BF24C057C10B9DD482CD9460BA8E8533F3AD389F0185DF7C8930F664A5C6EB0EFB552FC7D1315C9DDD3F7A1013E9A4B3C41C572AE0577C2F5E4D17196C6C7423028BF5A43A589A53A53B3E99699F3A13F5121D9F961445F1E5D06421F9AE252BE3F26B</code></pre>
<!-- end server_DH_inner_data_output -->
<!-- start server_DH_inner_data -->
<p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | BA 0D 89 B5 8E 5F 16 4A 0C 6B 62 63 47 92 D9 A2
0010 | 43 3E AC 5C FE 23 5C 20 EB 66 2B E4 8E D2 C1 3C
0020 | 79 3D 50 9C 03 00 00 00 FE 00 01 00 C7 1C AE B9
<pre><code>0000 | BA 0D 89 B5 FA 56 B8 81 4A 7D 8A 03 EF 19 33 5E
0010 | 6B 08 91 F0 DB 9F E2 2A 93 C1 07 45 08 DE 79 17
0020 | 1E 18 50 CE 03 00 00 00 FE 00 01 00 C7 1C AE B9
0030 | C6 B1 C9 04 8E 6C 52 2F 70 F1 3F 73 98 0D 40 23
0040 | 8E 3E 21 C1 49 34 D0 37 56 3D 93 0F 48 19 8A 0A
0050 | A7 C1 40 58 22 94 93 D2 25 30 F4 DB FA 33 6F 6E
@ -532,23 +532,23 @@ answer = BA0D89B58E5F164A0C6B62634792D9A2433EAC5CFE235C20EB662BE48ED2C13C793D509
0100 | F4 7B F9 59 D9 56 85 0C E9 29 85 1F 0D 81 15 F6
0110 | 35 B1 05 EE 2E 4E 15 D0 4B 24 54 BF 6F 4F AD F0
0120 | 34 B1 04 03 11 9C D8 E3 B9 2F CC 5B FE 00 01 00
0130 | B6 4E 75 C0 40 88 ED 0D F3 0F 06 C4 6C DD B4 8E
0140 | 9E 93 51 6B B5 A9 5E D4 58 53 D0 D5 E6 39 13 35
0150 | F5 EA E0 C9 57 73 DC BB 2C FD AD 99 91 B4 A3 61
0160 | DB 98 7C 20 B6 1D 2A 82 DF E8 90 ED 72 3E 61 A4
0170 | 6A D3 AB A8 A6 9D 0A E9 19 F3 8F A2 F4 52 A4 9B
0180 | 60 A8 74 0F 4A 0F 14 E0 C8 FD B8 45 3C E7 5A 0A
0190 | 9D 3D 22 AC EA 3E 56 D9 5D 5E 06 57 FB 91 C8 9A
01A0 | E9 F9 93 9A 0F 88 4D 09 FE 9D C6 D0 AD 3C 70 43
01B0 | 18 AB D2 7B 95 F8 C9 2E 2C 72 6D 0D A4 F4 06 CB
01C0 | F3 FB C1 8B D3 D0 EC F1 AB 61 63 D0 DC D2 5F A8
01D0 | 33 9B 29 82 83 AE DB A4 B3 22 CB 4C D3 84 D2 70
01E0 | 88 DA 94 41 8F C8 43 8A 6A FE 97 58 E6 60 D9 EF
01F0 | 60 0B 34 AB C5 21 D4 99 4F 0D 34 AD BC 2E 96 9A
0200 | D5 9B 73 C4 F1 F5 3B CA 58 5F 71 95 B4 74 6A CB
0210 | 70 DC 66 AB A8 B4 7B 65 51 8E 4E B0 EE 2B 4F 06
0220 | CB 98 AA 72 B5 17 51 17 8D 45 6E BC 3C 35 73 98
0230 | 2F 14 BD 64</code></pre>
0130 | 67 E9 0A 8C 78 7B 0B 93 9B 8C 4E 40 B5 B6 94 93
0140 | 88 42 78 6B 75 DB 89 3D FF 4D 30 9A 10 C3 FE 93
0150 | 23 C0 63 C0 53 A4 DC 2F 50 38 1F BC 84 1C D9 22
0160 | 1C 44 03 DA DC C7 C7 6B 64 24 35 81 0C B1 45 52
0170 | 67 84 A1 C4 D7 A6 82 57 55 94 8C F8 F2 E5 81 C1
0180 | 2A 7B 24 66 7E 7B 98 CD 43 35 C8 25 30 CF B4 2A
0190 | 0D 09 0C 44 1C F9 AE CC AD A3 06 8D D8 69 DD B8
01A0 | 58 5E 45 12 82 8F B2 71 75 97 58 84 52 91 57 EF
01B0 | C1 EB AF 7B 5B AC 78 70 55 1C D8 EB 71 76 95 C4
01C0 | D2 CA FB 71 C4 B1 52 D2 D1 A7 62 64 F1 A8 EF 91
01D0 | 39 CF 74 FE 94 5F 15 03 56 BF 24 C0 57 C1 0B 9D
01E0 | D4 82 CD 94 60 BA 8E 85 33 F3 AD 38 9F 01 85 DF
01F0 | 7C 89 30 F6 64 A5 C6 EB 0E FB 55 2F C7 D1 31 5C
0200 | 9D DD 3F 7A 10 13 E9 A4 B3 C4 1C 57 2A E0 57 7C
0210 | 2F 5E 4D 17 19 6C 6C 74 23 02 8B F5 A4 3A 58 9A
0220 | 53 A5 3B 3E 99 69 9F 3A 13 F5 12 1D 9F 96 14 45
0230 | F1 E5 D0 64</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:string g_a:string server_time:int = Server_DH_inner_data;</code></pre>
<table class="table">
@ -570,13 +570,13 @@ answer = BA0D89B58E5F164A0C6B62634792D9A2433EAC5CFE235C20EB662BE48ED2C13C793D509
<tr>
<td>nonce</td>
<td>4, 16</td>
<td><code>8E5F164A0C6B62634792D9A2433EAC5C</code></td>
<td><code>FA56B8814A7D8A03EF19335E6B0891F0</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>20, 16</td>
<td><code>FE235C20EB662BE48ED2C13C793D509C</code></td>
<td><code>DB9FE22A93C1074508DE79171E1850CE</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
@ -594,13 +594,13 @@ answer = BA0D89B58E5F164A0C6B62634792D9A2433EAC5CFE235C20EB662BE48ED2C13C793D509
<tr>
<td>g_a</td>
<td>300, 260</td>
<td><code>FE000100B64E75C04088ED0DF30F06C4</code> <code>6CDDB48E9E93516BB5A95ED45853D0D5</code> <code>E6391335F5EAE0C95773DCBB2CFDAD99</code> <code>91B4A361DB987C20B61D2A82DFE890ED</code> <code>723E61A46AD3ABA8A69D0AE919F38FA2</code> <code>F452A49B60A8740F4A0F14E0C8FDB845</code> <code>3CE75A0A9D3D22ACEA3E56D95D5E0657</code> <code>FB91C89AE9F9939A0F884D09FE9DC6D0</code> <code>AD3C704318ABD27B95F8C92E2C726D0D</code> <code>A4F406CBF3FBC18BD3D0ECF1AB6163D0</code> <code>DCD25FA8339B298283AEDBA4B322CB4C</code> <code>D384D27088DA94418FC8438A6AFE9758</code> <code>E660D9EF600B34ABC521D4994F0D34AD</code> <code>BC2E969AD59B73C4F1F53BCA585F7195</code> <code>B4746ACB70DC66ABA8B47B65518E4EB0</code> <code>EE2B4F06CB98AA72B51751178D456EBC</code><br> <code>3C357398</code></td>
<td><code>FE00010067E90A8C787B0B939B8C4E40</code> <code>B5B694938842786B75DB893DFF4D309A</code> <code>10C3FE9323C063C053A4DC2F50381FBC</code> <code>841CD9221C4403DADCC7C76B64243581</code> <code>0CB145526784A1C4D7A6825755948CF8</code> <code>F2E581C12A7B24667E7B98CD4335C825</code> <code>30CFB42A0D090C441CF9AECCADA3068D</code> <code>D869DDB8585E4512828FB27175975884</code> <code>529157EFC1EBAF7B5BAC7870551CD8EB</code> <code>717695C4D2CAFB71C4B152D2D1A76264</code> <code>F1A8EF9139CF74FE945F150356BF24C0</code> <code>57C10B9DD482CD9460BA8E8533F3AD38</code> <code>9F0185DF7C8930F664A5C6EB0EFB552F</code> <code>C7D1315C9DDD3F7A1013E9A4B3C41C57</code> <code>2AE0577C2F5E4D17196C6C7423028BF5</code> <code>A43A589A53A53B3E99699F3A13F5121D</code><br> <code>9F961445</code></td>
<td><code>g_a</code> diffie-hellman parameter</td>
</tr>
<tr>
<td>server_time</td>
<td>560, 4</td>
<td><code>2F14BD64</code> (1690113071 in decimal)</td>
<td><code>F1E5D064</code> (1691411953 in decimal)</td>
<td>Server time</td>
</tr>
</tbody>
@ -609,34 +609,34 @@ answer = BA0D89B58E5F164A0C6B62634792D9A2433EAC5CFE235C20EB662BE48ED2C13C793D509
<h5><a class="anchor" href="#7-client-computes-random-2048-bit-number-b-using-a-sufficient-amount-of-entropy-and-sends-the-server-a-message" id="7-client-computes-random-2048-bit-number-b-using-a-sufficient-amount-of-entropy-and-sends-the-server-a-message" name="7-client-computes-random-2048-bit-number-b-using-a-sufficient-amount-of-entropy-and-sends-the-server-a-message"><i class="anchor-icon"></i></a>7) Client computes random 2048-bit number <em>b</em> (using a sufficient amount of entropy) and sends the server a message</h5>
<p>First, generate a secure random 2048-bit number b:</p>
<!-- start b -->
<pre><code>b = 56C1449E5A2F720CBCADBB68EF35C1D815E9301191135A1419A9077B842C0341B2A182B29F1F79AB536792624D7B1C3BF4349ADCFA372F62666D9A63A1217C4CE21CB3D65D2125ABC96370300FE20FCFBE685207ABB301CE27F336D3A89544D3BCF5BB638785C5630712A22D2BEAE305804324847D01B831120B71F728338DB2A60F1905B2382FF5EA7AE58BB53CE8D9D0D73495977A7BF865989F17202E41DD6734581497AB0EA6597D82698145043F13BB626FA45CA73371BAF8F9B55D43D78AB6332B44FE461149B85311D7164BE672E41F5CC59D4447CB9B8F850C0B69479FFEADC7CF32D0DCA9153312EA33A5089C8FFA47D3876FCD1447C9F2358CCF83</code></pre>
<pre><code>b = DF27D4D1915AC970A121A59A49BBD6233DD10CABD7B7DCCBA343C2CADD7C8491968162A5AF50506C28C9E7FBFB6E7E2C7D54BC4F61767756C4F3949CA0D853F45F6A920B61239B173F2127B1174069C51B8E1289AA2FFB581747EE4C2565A326BEF154AEB6184CFAF42FFD1829B50950A703266462002AA1127CFCBC1E2B9932E80350746C981C6CE0D21844140A66EF9ED21E1D23B1E16E2F6DD94F61E400C13E75FD07AA40242490939E9A267069042864BF69655DC237DC512A8EE88C2CD043F7A6E8C3CE99C1AB6BD5A18BB23706228C88F8D65225309EEABEC0B36215993E21193B3DAB9701A848D63D30FBBF7611FB3B276BFC589EFFD765A823EA7A54</code></pre>
<!-- end b -->
<p>Then compute <code>g_b = pow(g, b) mod dh_prime</code></p>
<!-- start g_b -->
<pre><code>g_b = B2AD360A45789F4112258889A9715D4418EEE7C974812D2A84D5AD9914ED70EB24B15A22E4AE92BC94DCBC69B7CCC29E42DA828565A5E737393E572278B691D63464ACF501742F232E6A51B2CCE5F239DF9D2B6D79B10D6E471A0D6671843562820BA231CC9D9FAAE0656146F3A52577F7A2CC93E67AF54F1B3BF8B86A5D51E6B020671649675A4CA718A9F312FB65E52B0BAF8E41357D7F981B21F22F3279D656D409C45ABAD9D827EDB0D0888CDF68177AB4AFC91814640B3FC9A53502BAF163436E17B6A81F78183643668B767E89D396FFA8E8C93074BE51DC1AB533A4080A9ADC265FF04BF40D2696C24A28508D467AAB8A553521DC6D6B270E403CF988</code></pre>
<pre><code>g_b = 4353012BD4A1D36D836C48F49CAD0410F08C4F3212E9506B7BB9F4EE4022445E4E9EFFE99D7F373A1BE5398A816A46D4D456F9A70F634A76A13164DFF1C9CE9BC0DE47B00E69C59D99648C3B0993D2A06FF13DF6BF64FA0CAFD542AA5BD99D0886018E1D4D4C84E63FCCA409A7B32F27FBC2C94EE7BC7ED911BD6DB6A2EF4067F3083FA6385112FB9081A185970B7BA04596621BAF0742E1FECCEE8EEFE273DD01D72E370612A9C8891355D9A76FB4CCD1DA983792BA75ED8ABF23EF2D4828B66ABE938F73E0C29868BEFA3322ABB4CD6534623C97608964E845D275C394C8D067A92B892EC0647F5FEC960D54D1B380144D2253B5B268C8311FA96AF2B26B0A</code></pre>
<!-- end g_b -->
<h6>7.1) generation of encrypted_data</h6>
<!-- start client_DH_inner_data -->
<p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 54 B6 43 66 8E 5F 16 4A 0C 6B 62 63 47 92 D9 A2
0010 | 43 3E AC 5C FE 23 5C 20 EB 66 2B E4 8E D2 C1 3C
0020 | 79 3D 50 9C 00 00 00 00 00 00 00 00 FE 00 01 00
0030 | B2 AD 36 0A 45 78 9F 41 12 25 88 89 A9 71 5D 44
0040 | 18 EE E7 C9 74 81 2D 2A 84 D5 AD 99 14 ED 70 EB
0050 | 24 B1 5A 22 E4 AE 92 BC 94 DC BC 69 B7 CC C2 9E
0060 | 42 DA 82 85 65 A5 E7 37 39 3E 57 22 78 B6 91 D6
0070 | 34 64 AC F5 01 74 2F 23 2E 6A 51 B2 CC E5 F2 39
0080 | DF 9D 2B 6D 79 B1 0D 6E 47 1A 0D 66 71 84 35 62
0090 | 82 0B A2 31 CC 9D 9F AA E0 65 61 46 F3 A5 25 77
00A0 | F7 A2 CC 93 E6 7A F5 4F 1B 3B F8 B8 6A 5D 51 E6
00B0 | B0 20 67 16 49 67 5A 4C A7 18 A9 F3 12 FB 65 E5
00C0 | 2B 0B AF 8E 41 35 7D 7F 98 1B 21 F2 2F 32 79 D6
00D0 | 56 D4 09 C4 5A BA D9 D8 27 ED B0 D0 88 8C DF 68
00E0 | 17 7A B4 AF C9 18 14 64 0B 3F C9 A5 35 02 BA F1
00F0 | 63 43 6E 17 B6 A8 1F 78 18 36 43 66 8B 76 7E 89
0100 | D3 96 FF A8 E8 C9 30 74 BE 51 DC 1A B5 33 A4 08
0110 | 0A 9A DC 26 5F F0 4B F4 0D 26 96 C2 4A 28 50 8D
0120 | 46 7A AB 8A 55 35 21 DC 6D 6B 27 0E 40 3C F9 88</code></pre>
<pre><code>0000 | 54 B6 43 66 FA 56 B8 81 4A 7D 8A 03 EF 19 33 5E
0010 | 6B 08 91 F0 DB 9F E2 2A 93 C1 07 45 08 DE 79 17
0020 | 1E 18 50 CE 00 00 00 00 00 00 00 00 FE 00 01 00
0030 | 43 53 01 2B D4 A1 D3 6D 83 6C 48 F4 9C AD 04 10
0040 | F0 8C 4F 32 12 E9 50 6B 7B B9 F4 EE 40 22 44 5E
0050 | 4E 9E FF E9 9D 7F 37 3A 1B E5 39 8A 81 6A 46 D4
0060 | D4 56 F9 A7 0F 63 4A 76 A1 31 64 DF F1 C9 CE 9B
0070 | C0 DE 47 B0 0E 69 C5 9D 99 64 8C 3B 09 93 D2 A0
0080 | 6F F1 3D F6 BF 64 FA 0C AF D5 42 AA 5B D9 9D 08
0090 | 86 01 8E 1D 4D 4C 84 E6 3F CC A4 09 A7 B3 2F 27
00A0 | FB C2 C9 4E E7 BC 7E D9 11 BD 6D B6 A2 EF 40 67
00B0 | F3 08 3F A6 38 51 12 FB 90 81 A1 85 97 0B 7B A0
00C0 | 45 96 62 1B AF 07 42 E1 FE CC EE 8E EF E2 73 DD
00D0 | 01 D7 2E 37 06 12 A9 C8 89 13 55 D9 A7 6F B4 CC
00E0 | D1 DA 98 37 92 BA 75 ED 8A BF 23 EF 2D 48 28 B6
00F0 | 6A BE 93 8F 73 E0 C2 98 68 BE FA 33 22 AB B4 CD
0100 | 65 34 62 3C 97 60 89 64 E8 45 D2 75 C3 94 C8 D0
0110 | 67 A9 2B 89 2E C0 64 7F 5F EC 96 0D 54 D1 B3 80
0120 | 14 4D 22 53 B5 B2 68 C8 31 1F A9 6A F2 B2 6B 0A</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data;</code></pre>
<table class="table">
@ -658,19 +658,19 @@ answer = BA0D89B58E5F164A0C6B62634792D9A2433EAC5CFE235C20EB662BE48ED2C13C793D509
<tr>
<td>nonce</td>
<td>4, 16</td>
<td><code>8E5F164A0C6B62634792D9A2433EAC5C</code></td>
<td><code>FA56B8814A7D8A03EF19335E6B0891F0</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>20, 16</td>
<td><code>FE235C20EB662BE48ED2C13C793D509C</code></td>
<td><code>DB9FE22A93C1074508DE79171E1850CE</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>g_b</td>
<td>36, 260</td>
<td><code>FE000100B2AD360A45789F4112258889</code> <code>A9715D4418EEE7C974812D2A84D5AD99</code> <code>14ED70EB24B15A22E4AE92BC94DCBC69</code> <code>B7CCC29E42DA828565A5E737393E5722</code> <code>78B691D63464ACF501742F232E6A51B2</code> <code>CCE5F239DF9D2B6D79B10D6E471A0D66</code> <code>71843562820BA231CC9D9FAAE0656146</code> <code>F3A52577F7A2CC93E67AF54F1B3BF8B8</code> <code>6A5D51E6B020671649675A4CA718A9F3</code> <code>12FB65E52B0BAF8E41357D7F981B21F2</code> <code>2F3279D656D409C45ABAD9D827EDB0D0</code> <code>888CDF68177AB4AFC91814640B3FC9A5</code> <code>3502BAF163436E17B6A81F7818364366</code> <code>8B767E89D396FFA8E8C93074BE51DC1A</code> <code>B533A4080A9ADC265FF04BF40D2696C2</code> <code>4A28508D467AAB8A553521DC6D6B270E</code><br> <code>403CF988</code></td>
<td><code>FE0001004353012BD4A1D36D836C48F4</code> <code>9CAD0410F08C4F3212E9506B7BB9F4EE</code> <code>4022445E4E9EFFE99D7F373A1BE5398A</code> <code>816A46D4D456F9A70F634A76A13164DF</code> <code>F1C9CE9BC0DE47B00E69C59D99648C3B</code> <code>0993D2A06FF13DF6BF64FA0CAFD542AA</code> <code>5BD99D0886018E1D4D4C84E63FCCA409</code> <code>A7B32F27FBC2C94EE7BC7ED911BD6DB6</code> <code>A2EF4067F3083FA6385112FB9081A185</code> <code>970B7BA04596621BAF0742E1FECCEE8E</code> <code>EFE273DD01D72E370612A9C8891355D9</code> <code>A76FB4CCD1DA983792BA75ED8ABF23EF</code> <code>2D4828B66ABE938F73E0C29868BEFA33</code> <code>22ABB4CD6534623C97608964E845D275</code> <code>C394C8D067A92B892EC0647F5FEC960D</code> <code>54D1B380144D2253B5B268C8311FA96A</code><br> <code>F2B26B0A</code></td>
<td>Single-byte prefix denoting length, a 256-byte (2048-bit) string, and zero bytes of padding</td>
</tr>
<tr>
@ -684,47 +684,47 @@ answer = BA0D89B58E5F164A0C6B62634792D9A2433EAC5CFE235C20EB662BE48ED2C13C793D509
<!-- end client_DH_inner_data -->
<p>The serialization of <em>Client_DH_Inner_Data</em> produces a string <strong>data</strong>. This is used to generate <strong>encrypted_data</strong> as specified in <a href="#7-client-computes-random-2048-bit-number-b-using-a-sufficient-amount-of-entropy-and-sends-the-server-a-message">step 6</a>, using the following inputs:</p>
<!-- start client_DH_inner_data_input -->
<pre><code>data = 54B643668E5F164A0C6B62634792D9A2433EAC5CFE235C20EB662BE48ED2C13C793D509C0000000000000000FE000100B2AD360A45789F4112258889A9715D4418EEE7C974812D2A84D5AD9914ED70EB24B15A22E4AE92BC94DCBC69B7CCC29E42DA828565A5E737393E572278B691D63464ACF501742F232E6A51B2CCE5F239DF9D2B6D79B10D6E471A0D6671843562820BA231CC9D9FAAE0656146F3A52577F7A2CC93E67AF54F1B3BF8B86A5D51E6B020671649675A4CA718A9F312FB65E52B0BAF8E41357D7F981B21F22F3279D656D409C45ABAD9D827EDB0D0888CDF68177AB4AFC91814640B3FC9A53502BAF163436E17B6A81F78183643668B767E89D396FFA8E8C93074BE51DC1AB533A4080A9ADC265FF04BF40D2696C24A28508D467AAB8A553521DC6D6B270E403CF988
padding = 0807464CD9FF2CD3EFEB67DE
tmp_aes_key = ED0582A5A37DC51D44A48A3DB9BDE1BDA036E0883025EA375501EDB2CD8E19F0
tmp_aes_iv = D5646AAAEABD85D919B9FABFB922A5F55031EECBF9A4E95A9F28C2DA246230E0</code></pre>
<pre><code>data = 54B64366FA56B8814A7D8A03EF19335E6B0891F0DB9FE22A93C1074508DE79171E1850CE0000000000000000FE0001004353012BD4A1D36D836C48F49CAD0410F08C4F3212E9506B7BB9F4EE4022445E4E9EFFE99D7F373A1BE5398A816A46D4D456F9A70F634A76A13164DFF1C9CE9BC0DE47B00E69C59D99648C3B0993D2A06FF13DF6BF64FA0CAFD542AA5BD99D0886018E1D4D4C84E63FCCA409A7B32F27FBC2C94EE7BC7ED911BD6DB6A2EF4067F3083FA6385112FB9081A185970B7BA04596621BAF0742E1FECCEE8EEFE273DD01D72E370612A9C8891355D9A76FB4CCD1DA983792BA75ED8ABF23EF2D4828B66ABE938F73E0C29868BEFA3322ABB4CD6534623C97608964E845D275C394C8D067A92B892EC0647F5FEC960D54D1B380144D2253B5B268C8311FA96AF2B26B0A
padding = B600FC2C750DB82A853DB393
tmp_aes_key = 2254F20E901881266F49CA54E3BD0A187375A0440D8E90D69FA30C4FB4414477
tmp_aes_iv = D0D2643702C4C19E178AE141ACC6C2DF87CD0C761E8B13EC361296D1271FFA94</code></pre>
<!-- end client_DH_inner_data_input -->
<p>Process:</p>
<pre><code>data_with_hash := SHA1(data) + data + padding (0-15 random bytes such that total length is divisible by 16)
encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);</code></pre>
<p>Output:</p>
<!-- start client_DH_inner_data_output -->
<pre><code>encrypted_data = F884E111EAC9F52C28528E2FC28B3DF3599A8CF8337F2BFE2B85B3FB9D6F9E1AA70AD08F2BB3A7E6F670195F088B6E5ADCBD58BA8A560A974F3B083B20905F11D13BFF45A9DFACE5F79345363139C12F0A498D796D9B4E40E30EA9BAC8C0E3C2BCC717576D36EE5CBECFDBB9AD9C9B09003B65F02600B78268ED3A9EB5A5B70CDC97C87F1BD800F5A17762D55F19404621E1C8A0CB1E95828301ECDBC509472E0AB94DFDD80E060D660F3BF253FB3E8530267384123F01FBB090A2F56CB5D1EB40AE2D160805504C0B8C5F6DADA393F5E809E841AF42FE8EC4B1FE213AA6FAF27EFF98C7A9135A5CF9753ABBBBCE017B064A1AC29F82DDE8D8F8CD4296B6710DCA9812F643CE99EB55BC7EEA7F383903373B547938C07557CDE4D1307BB790781D0E3C0947282A2B13684D213A08818FA5DDA63C44F5BECA9687187DD9DC4FB19A91BE96CB946B9CDF5EFFE984415983</code></pre>
<pre><code>encrypted_data = CF16EAF8B7A0F9BB0A3AA114DE0C97B2629FEE1EF6160C98A198CCABED2AEC31954E252D389FE6A87C92E0B9D230C8288A13BD5DA24A4DEA736D6CC220773858E8923D5FA0AD0B9EF5DF01521F9728C2BD44D95A1D790AD1880FA00298DF1D01A492FA6D51FF327B94EAFA603367A3B5EC47CAD771987F4D2D1EC0FB0B39803F7C9666786584A5E6471AFE92C1D3EAAE256385D9372B2BDFCDC050B6699ADE25302E9B76B93D9E4B05CFB1DB24BB0C72B841240C84E1634CCC08BDF8969AB6B882B9C457C6EB95BE6BAC9F606B8D2DB83C1B824F854D11BE1FCCDEF8D212A4DDEF6F58C070607BFB5C283BC6501BF23B9D5B952B12A8EB28C7EA951810C4C0613CCC59CCDB4133564F3AFA7214F3EFC08528BBF0A2A9EB939128A98F7AADB8E195FD238AF6E918DA7408A4EF635B662D75C0130EE5742AE436EA6219084BB7139D7F36B7D9DEF7000615A7A48BDE8770</code></pre>
<!-- end client_DH_inner_data_output -->
<p>The length of the final string is 336 bytes.</p>
<h6>7.2) set_client_DH_params query</h6>
<!-- start set_client_DH_params -->
<p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 E4 51 02 00 2F 14 BD 64
0010 | 78 01 00 00 1F 5F 04 F5 8E 5F 16 4A 0C 6B 62 63
0020 | 47 92 D9 A2 43 3E AC 5C FE 23 5C 20 EB 66 2B E4
0030 | 8E D2 C1 3C 79 3D 50 9C FE 50 01 00 F8 84 E1 11
0040 | EA C9 F5 2C 28 52 8E 2F C2 8B 3D F3 59 9A 8C F8
0050 | 33 7F 2B FE 2B 85 B3 FB 9D 6F 9E 1A A7 0A D0 8F
0060 | 2B B3 A7 E6 F6 70 19 5F 08 8B 6E 5A DC BD 58 BA
0070 | 8A 56 0A 97 4F 3B 08 3B 20 90 5F 11 D1 3B FF 45
0080 | A9 DF AC E5 F7 93 45 36 31 39 C1 2F 0A 49 8D 79
0090 | 6D 9B 4E 40 E3 0E A9 BA C8 C0 E3 C2 BC C7 17 57
00A0 | 6D 36 EE 5C BE CF DB B9 AD 9C 9B 09 00 3B 65 F0
00B0 | 26 00 B7 82 68 ED 3A 9E B5 A5 B7 0C DC 97 C8 7F
00C0 | 1B D8 00 F5 A1 77 62 D5 5F 19 40 46 21 E1 C8 A0
00D0 | CB 1E 95 82 83 01 EC DB C5 09 47 2E 0A B9 4D FD
00E0 | D8 0E 06 0D 66 0F 3B F2 53 FB 3E 85 30 26 73 84
00F0 | 12 3F 01 FB B0 90 A2 F5 6C B5 D1 EB 40 AE 2D 16
0100 | 08 05 50 4C 0B 8C 5F 6D AD A3 93 F5 E8 09 E8 41
0110 | AF 42 FE 8E C4 B1 FE 21 3A A6 FA F2 7E FF 98 C7
0120 | A9 13 5A 5C F9 75 3A BB BB CE 01 7B 06 4A 1A C2
0130 | 9F 82 DD E8 D8 F8 CD 42 96 B6 71 0D CA 98 12 F6
0140 | 43 CE 99 EB 55 BC 7E EA 7F 38 39 03 37 3B 54 79
0150 | 38 C0 75 57 CD E4 D1 30 7B B7 90 78 1D 0E 3C 09
0160 | 47 28 2A 2B 13 68 4D 21 3A 08 81 8F A5 DD A6 3C
0170 | 44 F5 BE CA 96 87 18 7D D9 DC 4F B1 9A 91 BE 96
0180 | CB 94 6B 9C DF 5E FF E9 84 41 59 83</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 A4 14 0B 00 F2 E5 D0 64
0010 | 78 01 00 00 1F 5F 04 F5 FA 56 B8 81 4A 7D 8A 03
0020 | EF 19 33 5E 6B 08 91 F0 DB 9F E2 2A 93 C1 07 45
0030 | 08 DE 79 17 1E 18 50 CE FE 50 01 00 CF 16 EA F8
0040 | B7 A0 F9 BB 0A 3A A1 14 DE 0C 97 B2 62 9F EE 1E
0050 | F6 16 0C 98 A1 98 CC AB ED 2A EC 31 95 4E 25 2D
0060 | 38 9F E6 A8 7C 92 E0 B9 D2 30 C8 28 8A 13 BD 5D
0070 | A2 4A 4D EA 73 6D 6C C2 20 77 38 58 E8 92 3D 5F
0080 | A0 AD 0B 9E F5 DF 01 52 1F 97 28 C2 BD 44 D9 5A
0090 | 1D 79 0A D1 88 0F A0 02 98 DF 1D 01 A4 92 FA 6D
00A0 | 51 FF 32 7B 94 EA FA 60 33 67 A3 B5 EC 47 CA D7
00B0 | 71 98 7F 4D 2D 1E C0 FB 0B 39 80 3F 7C 96 66 78
00C0 | 65 84 A5 E6 47 1A FE 92 C1 D3 EA AE 25 63 85 D9
00D0 | 37 2B 2B DF CD C0 50 B6 69 9A DE 25 30 2E 9B 76
00E0 | B9 3D 9E 4B 05 CF B1 DB 24 BB 0C 72 B8 41 24 0C
00F0 | 84 E1 63 4C CC 08 BD F8 96 9A B6 B8 82 B9 C4 57
0100 | C6 EB 95 BE 6B AC 9F 60 6B 8D 2D B8 3C 1B 82 4F
0110 | 85 4D 11 BE 1F CC DE F8 D2 12 A4 DD EF 6F 58 C0
0120 | 70 60 7B FB 5C 28 3B C6 50 1B F2 3B 9D 5B 95 2B
0130 | 12 A8 EB 28 C7 EA 95 18 10 C4 C0 61 3C CC 59 CC
0140 | DB 41 33 56 4F 3A FA 72 14 F3 EF C0 85 28 BB F0
0150 | A2 A9 EB 93 91 28 A9 8F 7A AD B8 E1 95 FD 23 8A
0160 | F6 E9 18 DA 74 08 A4 EF 63 5B 66 2D 75 C0 13 0E
0170 | E5 74 2A E4 36 EA 62 19 08 4B B7 13 9D 7F 36 B7
0180 | D9 DE F7 00 06 15 A7 A4 8B DE 87 70</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer;</code></pre>
<table class="table">
@ -746,7 +746,7 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>E45102002F14BD64</code></td>
<td><code>A4140B00F2E5D064</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
@ -764,19 +764,19 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>8E5F164A0C6B62634792D9A2433EAC5C</code></td>
<td><code>FA56B8814A7D8A03EF19335E6B0891F0</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>FE235C20EB662BE48ED2C13C793D509C</code></td>
<td><code>DB9FE22A93C1074508DE79171E1850CE</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>encrypted_data</td>
<td>56, 340</td>
<td><code>FE500100F884E111EAC9F52C28528E2F</code> <code>C28B3DF3599A8CF8337F2BFE2B85B3FB</code> <code>9D6F9E1AA70AD08F2BB3A7E6F670195F</code> <code>088B6E5ADCBD58BA8A560A974F3B083B</code> <code>20905F11D13BFF45A9DFACE5F7934536</code> <code>3139C12F0A498D796D9B4E40E30EA9BA</code> <code>C8C0E3C2BCC717576D36EE5CBECFDBB9</code> <code>AD9C9B09003B65F02600B78268ED3A9E</code> <code>B5A5B70CDC97C87F1BD800F5A17762D5</code> <code>5F19404621E1C8A0CB1E95828301ECDB</code> <code>C509472E0AB94DFDD80E060D660F3BF2</code> <code>53FB3E8530267384123F01FBB090A2F5</code> <code>6CB5D1EB40AE2D160805504C0B8C5F6D</code> <code>ADA393F5E809E841AF42FE8EC4B1FE21</code> <code>3AA6FAF27EFF98C7A9135A5CF9753ABB</code> <code>BBCE017B064A1AC29F82DDE8D8F8CD42</code> <code>96B6710DCA9812F643CE99EB55BC7EEA</code> <code>7F383903373B547938C07557CDE4D130</code> <code>7BB790781D0E3C0947282A2B13684D21</code> <code>3A08818FA5DDA63C44F5BECA9687187D</code> <code>D9DC4FB19A91BE96CB946B9CDF5EFFE9</code><br> <code>84415983</code></td>
<td><code>FE500100CF16EAF8B7A0F9BB0A3AA114</code> <code>DE0C97B2629FEE1EF6160C98A198CCAB</code> <code>ED2AEC31954E252D389FE6A87C92E0B9</code> <code>D230C8288A13BD5DA24A4DEA736D6CC2</code> <code>20773858E8923D5FA0AD0B9EF5DF0152</code> <code>1F9728C2BD44D95A1D790AD1880FA002</code> <code>98DF1D01A492FA6D51FF327B94EAFA60</code> <code>3367A3B5EC47CAD771987F4D2D1EC0FB</code> <code>0B39803F7C9666786584A5E6471AFE92</code> <code>C1D3EAAE256385D9372B2BDFCDC050B6</code> <code>699ADE25302E9B76B93D9E4B05CFB1DB</code> <code>24BB0C72B841240C84E1634CCC08BDF8</code> <code>969AB6B882B9C457C6EB95BE6BAC9F60</code> <code>6B8D2DB83C1B824F854D11BE1FCCDEF8</code> <code>D212A4DDEF6F58C070607BFB5C283BC6</code> <code>501BF23B9D5B952B12A8EB28C7EA9518</code> <code>10C4C0613CCC59CCDB4133564F3AFA72</code> <code>14F3EFC08528BBF0A2A9EB939128A98F</code> <code>7AADB8E195FD238AF6E918DA7408A4EF</code> <code>635B662D75C0130EE5742AE436EA6219</code> <code>084BB7139D7F36B7D9DEF7000615A7A4</code><br> <code>8BDE8770</code></td>
<td>Encrypted client_DH_inner_data generated previously, serialized as a TL byte string</td>
</tr>
</tbody>
@ -785,17 +785,17 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<h5><a class="anchor" href="#8-auth-key-generation" id="8-auth-key-generation" name="8-auth-key-generation"><i class="anchor-icon"></i></a>8) Auth key generation</h5>
<p>The client computes the auth_key using formula <code>g_a^b mod dh_prime</code>:</p>
<!-- start auth_key -->
<pre><code>auth_key = 6CD4B349BC834B131D48FFD16564728AC22339AB1CE3A24C7424A6E91534775FAB4758AB0E780E522FCDA9412917348F9B6A6F7FE6CE11A623DE9D124E76C03BAE2850BBEB0150D1DA953103361B1E9EC4B53864AF2D6B63F80D18C815D333CB6BD2E6B2620A56FC95334E1119D2808DC99D9E97AE7726B4926593E8EDE3E28E531690392A56FBFFC06D5D9A13AAF98A8DD78DF0EFA46C532DC688C52F34E3968C6F44BDF19AE934A34F6B506E292768BFC716FEFC117F8A1B6F069AF7BC249275142FD83301E27699764B0656669636CC054CF9B70A5154A3ED818DA7A6208DC35501248D7A23D519836A8E53DB8ADC481C603131C0D0B8C740D83D87B1C48C</code></pre>
<pre><code>auth_key = 2E5F591B50199135DAEA65BA82D78F6FC1854659353E081C6341BA5D2DBA42BD05BC591089118A1D6068D02706570020B1BBC205A02D272A601C93E44C93C6183501584C07095120B9DEEF74B92F9E6237ADB0DECC32A5BC271270DCDCFE697A432351F7A02271DD125D92F8BAB19C999112DB4DF5D99BA36A179E0CC642EF6A28CB777F45B1F2DE8558D050B5197DB55F8B9CC72A4E56131ED0AADC35B603685932E70342378BD384E99F2E9568F0ABB6BFE9E312157EEF73674F47BDD4D78E0E8F02173C6F0364ACD2F9471E80A450C635F43942F3690F0D47AF0BC8C2B94237734760F5843FD8FFF86A43F0BB547F5173867AEB7FA1F70BA45A11B929791E</code></pre>
<!-- end auth_key -->
<h5><a class="anchor" href="#9-final-server-reply" id="9-final-server-reply" name="9-final-server-reply"><i class="anchor-icon"></i></a>9) Final server reply</h5>
<p>The server verifies and confirms that auth_key_hash is unique: since it's unique, it replies with the following:</p>
<!-- start dh_gen_ok -->
<p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 E4 FB C3 2F 14 BD 64
0010 | A8 00 00 00 34 F7 CB 3B 8E 5F 16 4A 0C 6B 62 63
0020 | 47 92 D9 A2 43 3E AC 5C FE 23 5C 20 EB 66 2B E4
0030 | 8E D2 C1 3C 79 3D 50 9C AD CC 2D 0E 37 33 E7 FC
0040 | EE 4D ED 0E 31 E6 84 A8</code></pre>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 38 C2 AC F2 E5 D0 64
0010 | B0 00 00 00 34 F7 CB 3B FA 56 B8 81 4A 7D 8A 03
0020 | EF 19 33 5E 6B 08 91 F0 DB 9F E2 2A 93 C1 07 45
0030 | 08 DE 79 17 1E 18 50 CE 5A DB 0C 24 7A D2 98 7E
0040 | 73 47 83 C3 0A 1B 96 56</code></pre>
<p>Payload (de)serialization:</p>
<pre><code>dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer;</code></pre>
<table class="table">
@ -817,13 +817,13 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr>
<td>message_id</td>
<td>8, 8</td>
<td><code>01E4FBC32F14BD64</code></td>
<td><code>0138C2ACF2E5D064</code></td>
<td>Message ID generated as specified <a href="/mtproto/description#message-identifier-msg-id">here »</a> (unixtime() &lt;&lt; 32) + (N*4)</td>
</tr>
<tr>
<td>message_length</td>
<td>16, 4</td>
<td><code>A8000000</code> (168 in decimal)</td>
<td><code>B0000000</code> (176 in decimal)</td>
<td>Message body length</td>
</tr>
<tr>
@ -835,19 +835,19 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr>
<td>nonce</td>
<td>24, 16</td>
<td><code>8E5F164A0C6B62634792D9A2433EAC5C</code></td>
<td><code>FA56B8814A7D8A03EF19335E6B0891F0</code></td>
<td>Value generated by client in Step 1</td>
</tr>
<tr>
<td>server_nonce</td>
<td>40, 16</td>
<td><code>FE235C20EB662BE48ED2C13C793D509C</code></td>
<td><code>DB9FE22A93C1074508DE79171E1850CE</code></td>
<td>Value received from server in Step 2</td>
</tr>
<tr>
<td>new_nonce_hash1</td>
<td>56, 16</td>
<td><code>ADCC2D0E3733E7FCEE4DED0E31E684A8</code></td>
<td><code>5ADB0C247AD2987E734783C30A1B9656</code></td>
<td>The 128 lower-order bits of SHA1 of the byte string derived from the <code>new_nonce</code> string by adding a single byte with the value of 1, 2, or 3, and followed by another 8 bytes with <code>auth_key_aux_hash</code>. Different values are required to prevent an intruder from changing server response dh_gen_ok into dh_gen_retry.</td>
</tr>
</tbody>