Update content of files

This commit is contained in:
GitHub Action 2024-07-25 14:41:13 +00:00
parent bca67aac2c
commit d0502c9848
4 changed files with 217 additions and 213 deletions

View file

@ -74,7 +74,9 @@ Methods that can be called by bots will have a <strong>Bots can use this method<
<h3><a class="anchor" href="#attachment-menu-" id="attachment-menu-" name="attachment-menu-"><i class="anchor-icon"></i></a><a href="/api/bots/attach">Attachment menu »</a></h3> <h3><a class="anchor" href="#attachment-menu-" id="attachment-menu-" name="attachment-menu-"><i class="anchor-icon"></i></a><a href="/api/bots/attach">Attachment menu »</a></h3>
<p>Bots can install attachment menu entries, offering conveniently accessible, versatile web apps.</p> <p>Bots can install attachment menu entries, offering conveniently accessible, versatile web apps.</p>
<h3><a class="anchor" href="#business-bots-" id="business-bots-" name="business-bots-"><i class="anchor-icon"></i></a><a href="/api/business#connected-bots">Business bots »</a></h3> <h3><a class="anchor" href="#business-bots-" id="business-bots-" name="business-bots-"><i class="anchor-icon"></i></a><a href="/api/business#connected-bots">Business bots »</a></h3>
<p>Business users can connect Telegram bots that will process and answer messages <strong>on their behalf</strong>. This allows businesses to <strong>seamlessly integrate</strong> any existing tools and workflows, or add <strong>AI assistants</strong> that manage their chats.</p></div> <p>Business users can connect Telegram bots that will process and answer messages <strong>on their behalf</strong>. This allows businesses to <strong>seamlessly integrate</strong> any existing tools and workflows, or add <strong>AI assistants</strong> that manage their chats. </p>
<h3><a class="anchor" href="#bot-api-dialog-ids" id="bot-api-dialog-ids" name="bot-api-dialog-ids"><i class="anchor-icon"></i></a><a href="/api/bots/ids">Bot API dialog IDs</a></h3>
<p>How to convert MTProto peer IDs to bot API dialog IDs and vice versa.</p></div>
</div> </div>

View file

@ -44,9 +44,10 @@
<div id="dev_page_content"><!-- scroll_nav --> <div id="dev_page_content"><!-- scroll_nav -->
<p>The <code>id</code> field of <a href="/api/peers">peers »</a> (i.e. users, chats, channels) contain three distinct sequences of unique 64-bit IDs used to identify a specific user, chat or channel. </p> <p>The <code>id</code> field of <a href="/api/peers">peers »</a> (i.e. users, chats, channels, secret chats) contain four distinct sequences of unique 64-bit IDs used to identify a specific user, chat, channel or secret chat. </p>
<p>The ID sequences of users, chats and channels <strong>overlap</strong>, so it is a good idea to transform the peer IDs to bot API dialog IDs as specified below. </p> <p>The ID sequences of users, chats, channels and secret chats <strong>overlap</strong>, so it is a good idea to transform the peer IDs to bot API dialog IDs as specified below. </p>
<p>A bot API dialog ID is a single, unique 64-bit peer ID sequence derived from the user, chat and channel ID sequences, maintaining uniqueness across all of them. </p> <p>A bot API dialog ID is a single, unique 64-bit peer ID sequence derived from the user, chat, channel and secret chat ID sequences, maintaining uniqueness across all of them.<br>
Bot API dialog IDs are already used in the <a href="/bots/api">bot API</a> and in the underlying <a href="https://github.com/tdlib/td">tdlib</a> library to identify peers. </p>
<p>As specified above, a bot API dialog ID may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But, thanks to the ranges of the underlying MTProto IDs (specified below), it has at most 52 significant bits, so a 64-bit integer or even a double-precision float type are safe for storing this identifier. </p> <p>As specified above, a bot API dialog ID may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But, thanks to the ranges of the underlying MTProto IDs (specified below), it has at most 52 significant bits, so a 64-bit integer or even a double-precision float type are safe for storing this identifier. </p>
<p>More specifically, a bot API dialog ID ranges from <code>-2002147483648</code> to <code>1099511627775</code>. </p> <p>More specifically, a bot API dialog ID ranges from <code>-2002147483648</code> to <code>1099511627775</code>. </p>
<p>It's a good idea to transform peer IDs to bot dialog API IDs even if you do decide to use separate databases to <a href="/api/peers">store info about peers</a>, as it will make IDs more visually recognizable both for you and your users, as well as guarantee compatibility with the bot API, and allow your client to easily identify the type of a peer just by using its ID, thanks to the range checks specified below.</p> <p>It's a good idea to transform peer IDs to bot dialog API IDs even if you do decide to use separate databases to <a href="/api/peers">store info about peers</a>, as it will make IDs more visually recognizable both for you and your users, as well as guarantee compatibility with the bot API, and allow your client to easily identify the type of a peer just by using its ID, thanks to the range checks specified below.</p>
@ -69,11 +70,12 @@ $chatId = -$botApiChatId;</code></pre>
<pre><code>$botApiChannelId = -(1000000000000 + $channelId); <pre><code>$botApiChannelId = -(1000000000000 + $channelId);
$channelId = -$botApiChannelId - 1000000000000;</code></pre> $channelId = -$botApiChannelId - 1000000000000;</code></pre>
<h3><a class="anchor" href="#secret-chat-ids" id="secret-chat-ids" name="secret-chat-ids"><i class="anchor-icon"></i></a>Secret chat IDs</h3> <h3><a class="anchor" href="#secret-chat-ids" id="secret-chat-ids" name="secret-chat-ids"><i class="anchor-icon"></i></a>Secret chat IDs</h3>
<p><a href="/api/end-to-end">Secret chat IDs</a> in the MTProto API range from <code>-2147483648</code> to <code>2147483647</code> (inclusive, treat the secret chat ID as a signed 32-bit integer). </p> <p><a href="/api/end-to-end">Secret chat IDs</a> in the MTProto API range from <code>-2147483648</code> to <code>2147483647</code> (inclusive, treat the secret chat ID as a signed little-endian 32-bit integer). </p>
<p>To convert MTProto chat IDs to bot API chat secret chat IDs, subtract <code>2000000000000</code>. </p> <p>To convert MTProto chat IDs to bot API chat secret chat IDs, subtract <code>2000000000000</code>. </p>
<p>Before conversion, always validate that they fall within the range specified above (appropriately transformed for bot API secret chat dialog IDs, i.e. <code>-2002147483648</code> to <code>-1997852516353</code> inclusively). </p> <p>Before conversion, always validate that they fall within the range specified above (appropriately transformed for bot API secret chat dialog IDs, i.e. <code>-2002147483648</code> to <code>-1997852516353</code> inclusively). </p>
<pre><code>$botApiSecretChatId = $secretChatId - 2000000000000; <pre><code>$botApiSecretChatId = $secretChatId - 2000000000000;
$secretChatId = $botApiSecretChatId + 2000000000000;</code></pre></div> $secretChatId = $botApiSecretChatId + 2000000000000;</code></pre>
<p>Note: while the official instance of the bot API does not support secret chats, the underlying <a href="https://github.com/tdlib/td/">tdlib</a> library does support them, and uses the format mentioned above for secret chat IDs.</p></div>
</div> </div>

View file

@ -156,7 +156,7 @@
<tr> <tr>
<td><strong>premium</strong></td> <td><strong>premium</strong></td>
<td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.28?<a href="/constructor/true">true</a></td> <td style="text-align: center;"><a href="/mtproto/TL-combinators#conditional-fields">flags</a>.28?<a href="/constructor/true">true</a></td>
<td>Whether this user is a Telegram Premium user <br>Changes to this flag should invalidate the local <a href="/constructor/userFull">userFull</a> cache for this user ID. <br>Changes to this flag if the <code>self</code> flag is set should also trigger the following calls, to refresh the respective caches: <br>- <a href="/method/help.getConfig">help.getConfig</a> <br>- <a href="/method/messages.getTopReactions">messages.getTopReactions</a> if the <code>bot</code> flag is <strong>not</strong> set</td> <td>Whether this user is a Telegram Premium user <br>Changes to this flag should invalidate the local <a href="/constructor/userFull">userFull</a> cache for this user ID. <br>Changes to this flag if the <code>self</code> flag is set should also trigger the following calls, to refresh the respective caches: <br>- The <a href="/method/help.getConfig">help.getConfig</a> cache <br>- The <a href="/method/messages.getTopReactions">messages.getTopReactions</a> cache if the <code>bot</code> flag is <strong>not</strong> set</td>
</tr> </tr>
<tr> <tr>
<td><strong>attach_menu_enabled</strong></td> <td><strong>attach_menu_enabled</strong></td>

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> <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 --> <!-- start req_pq_multi -->
<p>Sent payload (excluding transport headers/trailers):</p> <p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 14 6F 0E 00 45 49 A1 66 <pre><code>0000 | 00 00 00 00 00 00 00 00 1C DF 07 00 6D 4C A1 66
0010 | 14 00 00 00 F1 8E 7E BE C3 FA 31 68 7F B1 4A FE 0010 | 14 00 00 00 F1 8E 7E BE 63 87 AF ED 66 02 EE C4
0020 | 6E BB 7B F5 D8 7B 57 4C</code></pre> 0020 | BE 34 FF AB CB 78 31 46</code></pre>
<p>Payload (de)serialization:</p> <p>Payload (de)serialization:</p>
<pre><code>req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;</code></pre> <pre><code>req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;</code></pre>
<table class="table"> <table class="table">
@ -77,7 +77,7 @@
<tr> <tr>
<td>message_id</td> <td>message_id</td>
<td>8, 8</td> <td>8, 8</td>
<td><code>146F0E004549A166</code></td> <td><code>1CDF07006D4CA166</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> <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>
<tr> <tr>
@ -95,7 +95,7 @@
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>24, 16</td> <td>24, 16</td>
<td><code>C3FA31687FB14AFE6EBB7BF5D87B574C</code></td> <td><code>6387AFED6602EEC4BE34FFABCB783146</code></td>
<td>Random number</td> <td>Random number</td>
</tr> </tr>
</tbody> </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> <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 --> <!-- start resPQ -->
<p>Received payload (excluding transport headers/trailers):</p> <p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 D4 D3 1E 45 49 A1 66 <pre><code>0000 | 00 00 00 00 00 00 00 00 01 54 82 F4 6D 4C A1 66
0010 | C8 00 00 00 63 24 16 05 C3 FA 31 68 7F B1 4A FE 0010 | BC 00 00 00 63 24 16 05 63 87 AF ED 66 02 EE C4
0020 | 6E BB 7B F5 D8 7B 57 4C 93 54 8E 81 C9 C9 93 7B 0020 | BE 34 FF AB CB 78 31 46 91 81 A5 0F 01 24 0C A8
0030 | EF 21 FB BF 00 90 7E FF 08 26 4C BF 7C 87 82 6D 0030 | 58 79 08 6C 85 0C 6C 58 08 1F 93 90 C2 6C D9 D8
0040 | C3 00 00 00 15 C4 B5 1C 03 00 00 00 A5 B7 F7 09 0040 | E5 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 0050 | 35 5F C3 0B 21 6B E8 6C 02 2B B4 C3 85 FD 64 DE
0060 | 85 1D 9D D0</code></pre> 0060 | 85 1D 9D D0</code></pre>
<p>Payload (de)serialization:</p> <p>Payload (de)serialization:</p>
@ -132,13 +132,13 @@
<tr> <tr>
<td>message_id</td> <td>message_id</td>
<td>8, 8</td> <td>8, 8</td>
<td><code>01D4D31E4549A166</code></td> <td><code>015482F46D4CA166</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> <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>
<tr> <tr>
<td>message_length</td> <td>message_length</td>
<td>16, 4</td> <td>16, 4</td>
<td><code>C8000000</code> (200 in decimal)</td> <td><code>BC000000</code> (188 in decimal)</td>
<td>Message body length</td> <td>Message body length</td>
</tr> </tr>
<tr> <tr>
@ -150,19 +150,19 @@
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>24, 16</td> <td>24, 16</td>
<td><code>C3FA31687FB14AFE6EBB7BF5D87B574C</code></td> <td><code>6387AFED6602EEC4BE34FFABCB783146</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>40, 16</td> <td>40, 16</td>
<td><code>93548E81C9C9937BEF21FBBF00907EFF</code></td> <td><code>9181A50F01240CA85879086C850C6C58</code></td>
<td>Server-generated random number</td> <td>Server-generated random number</td>
</tr> </tr>
<tr> <tr>
<td>pq</td> <td>pq</td>
<td>56, 12</td> <td>56, 12</td>
<td><code>08264CBF7C87826DC3000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 2759791213241593283</td> <td><code>081F9390C26CD9D8E5000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 2275321401476503781</td>
<td>Single-byte prefix denoting length, an 8-byte string, and three bytes of padding</td> <td>Single-byte prefix denoting length, an 8-byte string, and three bytes of padding</td>
</tr> </tr>
<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> <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-lt-q" id="3-client-decomposes-pq-into-prime-factors-such-that-p-lt-q" name="3-client-decomposes-pq-into-prime-factors-such-that-p-lt-q"><i class="anchor-icon"></i></a>3) Client decomposes pq into prime factors such that p &lt; q.</h5> <h5><a class="anchor" href="#3-client-decomposes-pq-into-prime-factors-such-that-p-lt-q" id="3-client-decomposes-pq-into-prime-factors-such-that-p-lt-q" name="3-client-decomposes-pq-into-prime-factors-such-that-p-lt-q"><i class="anchor-icon"></i></a>3) Client decomposes pq into prime factors such that p &lt; q.</h5>
<!-- start pq --> <!-- start pq -->
<pre><code>pq = 2759791213241593283</code></pre> <pre><code>pq = 2275321401476503781</code></pre>
<p>Decompose into 2 prime cofactors <code>p &lt; q</code>: <code>2759791213241593283 = 1506452021 * 1831980823</code></p> <p>Decompose into 2 prime cofactors <code>p &lt; q</code>: <code>2275321401476503781 = 1239149183 * 1836196507</code></p>
<pre><code>p = 1506452021 <pre><code>p = 1239149183
q = 1831980823</code></pre> q = 1836196507</code></pre>
<!-- end pq --> <!-- 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> <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> <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> <p>First of all, generate an <code>encrypted_data</code> payload as follows:</p>
<!-- start p_q_inner_data_dc --> <!-- start p_q_inner_data_dc -->
<p>Generated payload (excluding transport headers/trailers):</p> <p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 95 5F F5 A9 08 26 4C BF 7C 87 82 6D C3 00 00 00 <pre><code>0000 | 95 5F F5 A9 08 1F 93 90 C2 6C D9 D8 E5 00 00 00
0010 | 04 59 CA A2 35 00 00 00 04 6D 31 CF 17 00 00 00 0010 | 04 49 DB EA 7F 00 00 00 04 6D 72 22 9B 00 00 00
0020 | C3 FA 31 68 7F B1 4A FE 6E BB 7B F5 D8 7B 57 4C 0020 | 63 87 AF ED 66 02 EE C4 BE 34 FF AB CB 78 31 46
0030 | 93 54 8E 81 C9 C9 93 7B EF 21 FB BF 00 90 7E FF 0030 | 91 81 A5 0F 01 24 0C A8 58 79 08 6C 85 0C 6C 58
0040 | 8E 82 B2 E5 69 2C 07 17 41 E1 46 76 3E CD 3E DB 0040 | 5E 49 3C EC F0 53 CD 5D B9 A4 CF CF 43 9E 30 1B
0050 | 60 1C B7 6C 66 70 C6 99 46 11 C8 5E 20 42 1F 99 0050 | 7D D6 65 88 10 55 C1 AB 0D 63 D0 A9 7E 76 57 63
0060 | 02 00 00 00</code></pre> 0060 | 02 00 00 00</code></pre>
<p>Payload (de)serialization:</p> <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> <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 = 1831980823</code></pre>
<tr> <tr>
<td>pq</td> <td>pq</td>
<td>4, 12</td> <td>4, 12</td>
<td><code>08264CBF7C87826DC3000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 2759791213241593283</td> <td><code>081F9390C26CD9D8E5000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 2275321401476503781</td>
<td>Single-byte prefix denoting length, 8-byte string, and three bytes of padding</td> <td>Single-byte prefix denoting length, 8-byte string, and three bytes of padding</td>
</tr> </tr>
<tr> <tr>
<td>p</td> <td>p</td>
<td>16, 8</td> <td>16, 8</td>
<td><code>0459CAA235000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1506452021</td> <td><code>0449DBEA7F000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1239149183</td>
<td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td> <td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr> </tr>
<tr> <tr>
<td>q</td> <td>q</td>
<td>24, 8</td> <td>24, 8</td>
<td><code>046D31CF17000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1831980823</td> <td><code>046D72229B000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1836196507</td>
<td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td> <td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr> </tr>
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>32, 16</td> <td>32, 16</td>
<td><code>C3FA31687FB14AFE6EBB7BF5D87B574C</code></td> <td><code>6387AFED6602EEC4BE34FFABCB783146</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>48, 16</td> <td>48, 16</td>
<td><code>93548E81C9C9937BEF21FBBF00907EFF</code></td> <td><code>9181A50F01240CA85879086C850C6C58</code></td>
<td>Value received from server in Step 2</td> <td>Value received from server in Step 2</td>
</tr> </tr>
<tr> <tr>
<td>new_nonce</td> <td>new_nonce</td>
<td>64, 32</td> <td>64, 32</td>
<td><code>8E82B2E5692C071741E146763ECD3EDB</code> <code>601CB76C6670C6994611C85E20421F99</code></td> <td><code>5E493CECF053CD5DB9A4CFCF439E301B</code> <code>7DD665881055C1AB0D63D0A97E765763</code></td>
<td>Client-generated random number</td> <td>Client-generated random number</td>
</tr> </tr>
<tr> <tr>
@ -291,39 +291,39 @@ q = 1831980823</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> <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> 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 --> <!-- start p_q_inner_data_input -->
<pre><code>data = 955FF5A908264CBF7C87826DC30000000459CAA235000000046D31CF17000000C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EFF8E82B2E5692C071741E146763ECD3EDB601CB76C6670C6994611C85E20421F9902000000 <pre><code>data = 955FF5A9081F9390C26CD9D8E50000000449DBEA7F000000046D72229B0000006387AFED6602EEC4BE34FFABCB7831469181A50F01240CA85879086C850C6C585E493CECF053CD5DB9A4CFCF439E301B7DD665881055C1AB0D63D0A97E76576302000000
random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915F9CB47068A3C6872388CAF63EFFE9FA7676AE2D87D05E5F0A5BC3467935B59F24414D219C5436AC0F3BEC1F512233FACB9623FB6A73074692E31A0672923F65</code></pre> random_padding_bytes = 0698269139B02028B47DE71A40CD62C1A289DADF0EAD34F3C433FD23A0620195304EB11ACC6A85FAFC827A9E91280C61523CDF0FF3AC654E2F06FD60D2FFEB4D921ABF6131D3B8C652ABAAEFDF1F3FCEC5FA060C99B13498891F0F89</code></pre>
<!-- end p_q_inner_data_input --> <!-- end p_q_inner_data_input -->
<p>And this is the output:</p> <p>And this is the output:</p>
<!-- start p_q_inner_data_output --> <!-- start p_q_inner_data_output -->
<pre><code>encrypted_data = 060322C172A83BC12CFE35E07606AB8D66671FEF502655CD9F0710056C1F0D1ECC01C45243FFF3609A97B1335687D4E82DB680B9A4C71B3FC0E0CDF2F1680B604AFE0BDE34A8D43CD1A52D4D7144FF87482141F4B96B390216483DBF7D393F502ED148BB030D463B52464E6689E280CF602DC7A5370AD9AC4407EEA650FA631431B32B92381226A17122CFD063C7B687D3A5BBAA120E234B891824D720381E743297EEF9FE34D28DE82F506AD2FED78404AB7A27C6DF81ADCDB797C3EEA331C6883700DAC0E466B77DF36812F14A37F95A617C96C9C319AEED1D68DA2303EAFB4EFAA2BD36517BC044F10C5C2C8ECF5A2917FDFF06EBE9C4A4BE412D321AEDC1</code></pre> <pre><code>encrypted_data = 8731291CDD5513220A82626E9BE5FFBE1F760F72AA6D277BE83F2132B0734E46B518AADF0AC8E2348E1CCC3474C7F6F72C4874B2313DCF8F5E40C978B3317DB30872B428DE70FA6317DA068B31C428414AD03B8ACE80D222A48EA4AEA93D1AAB7B98B36820D68723F2110BEBEFA56EEEE1989226A902E2D0A7116D1F90E1CDBBE735C85948FD12AA010E94A6B8CA76B641EDA7D81571260D9B68D1C8DD23D3875255DFEC41C90B7FD00D08FDF4C1FF4EB91063D51790FE3F3B96E6FE9476D076A1ECB55E7ED1B9221353B9EADDBDB1E71CBDE9E08B1211355CBEFD12D6350361515CBCF4991A280A40AD95A5F6F73DC24658580FFD89F29B65D5FDC0677F333E</code></pre>
<!-- end p_q_inner_data_output --> <!-- end p_q_inner_data_output -->
<p>The length of the final string is 256 bytes.</p> <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> <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 --> <!-- start req_DH_params -->
<p>Sent payload (excluding transport headers/trailers):</p> <p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 18 6F 0E 00 45 49 A1 66 <pre><code>0000 | 00 00 00 00 00 00 00 00 F0 28 0E 00 6E 4C A1 66
0010 | 40 01 00 00 BE E4 12 D7 C3 FA 31 68 7F B1 4A FE 0010 | 40 01 00 00 BE E4 12 D7 63 87 AF ED 66 02 EE C4
0020 | 6E BB 7B F5 D8 7B 57 4C 93 54 8E 81 C9 C9 93 7B 0020 | BE 34 FF AB CB 78 31 46 91 81 A5 0F 01 24 0C A8
0030 | EF 21 FB BF 00 90 7E FF 04 59 CA A2 35 00 00 00 0030 | 58 79 08 6C 85 0C 6C 58 04 49 DB EA 7F 00 00 00
0040 | 04 6D 31 CF 17 00 00 00 85 FD 64 DE 85 1D 9D D0 0040 | 04 6D 72 22 9B 00 00 00 85 FD 64 DE 85 1D 9D D0
0050 | FE 00 01 00 06 03 22 C1 72 A8 3B C1 2C FE 35 E0 0050 | FE 00 01 00 87 31 29 1C DD 55 13 22 0A 82 62 6E
0060 | 76 06 AB 8D 66 67 1F EF 50 26 55 CD 9F 07 10 05 0060 | 9B E5 FF BE 1F 76 0F 72 AA 6D 27 7B E8 3F 21 32
0070 | 6C 1F 0D 1E CC 01 C4 52 43 FF F3 60 9A 97 B1 33 0070 | B0 73 4E 46 B5 18 AA DF 0A C8 E2 34 8E 1C CC 34
0080 | 56 87 D4 E8 2D B6 80 B9 A4 C7 1B 3F C0 E0 CD F2 0080 | 74 C7 F6 F7 2C 48 74 B2 31 3D CF 8F 5E 40 C9 78
0090 | F1 68 0B 60 4A FE 0B DE 34 A8 D4 3C D1 A5 2D 4D 0090 | B3 31 7D B3 08 72 B4 28 DE 70 FA 63 17 DA 06 8B
00A0 | 71 44 FF 87 48 21 41 F4 B9 6B 39 02 16 48 3D BF 00A0 | 31 C4 28 41 4A D0 3B 8A CE 80 D2 22 A4 8E A4 AE
00B0 | 7D 39 3F 50 2E D1 48 BB 03 0D 46 3B 52 46 4E 66 00B0 | A9 3D 1A AB 7B 98 B3 68 20 D6 87 23 F2 11 0B EB
00C0 | 89 E2 80 CF 60 2D C7 A5 37 0A D9 AC 44 07 EE A6 00C0 | EF A5 6E EE E1 98 92 26 A9 02 E2 D0 A7 11 6D 1F
00D0 | 50 FA 63 14 31 B3 2B 92 38 12 26 A1 71 22 CF D0 00D0 | 90 E1 CD BB E7 35 C8 59 48 FD 12 AA 01 0E 94 A6
00E0 | 63 C7 B6 87 D3 A5 BB AA 12 0E 23 4B 89 18 24 D7 00E0 | B8 CA 76 B6 41 ED A7 D8 15 71 26 0D 9B 68 D1 C8
00F0 | 20 38 1E 74 32 97 EE F9 FE 34 D2 8D E8 2F 50 6A 00F0 | DD 23 D3 87 52 55 DF EC 41 C9 0B 7F D0 0D 08 FD
0100 | D2 FE D7 84 04 AB 7A 27 C6 DF 81 AD CD B7 97 C3 0100 | F4 C1 FF 4E B9 10 63 D5 17 90 FE 3F 3B 96 E6 FE
0110 | EE A3 31 C6 88 37 00 DA C0 E4 66 B7 7D F3 68 12 0110 | 94 76 D0 76 A1 EC B5 5E 7E D1 B9 22 13 53 B9 EA
0120 | F1 4A 37 F9 5A 61 7C 96 C9 C3 19 AE ED 1D 68 DA 0120 | DD BD B1 E7 1C BD E9 E0 8B 12 11 35 5C BE FD 12
0130 | 23 03 EA FB 4E FA A2 BD 36 51 7B C0 44 F1 0C 5C 0130 | D6 35 03 61 51 5C BC F4 99 1A 28 0A 40 AD 95 A5
0140 | 2C 8E CF 5A 29 17 FD FF 06 EB E9 C4 A4 BE 41 2D 0140 | F6 F7 3D C2 46 58 58 0F FD 89 F2 9B 65 D5 FD C0
0150 | 32 1A ED C1</code></pre> 0150 | 67 7F 33 3E</code></pre>
<p>Payload (de)serialization:</p> <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> <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"> <table class="table">
@ -345,7 +345,7 @@ random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915
<tr> <tr>
<td>message_id</td> <td>message_id</td>
<td>8, 8</td> <td>8, 8</td>
<td><code>186F0E004549A166</code></td> <td><code>F0280E006E4CA166</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> <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>
<tr> <tr>
@ -363,25 +363,25 @@ random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>24, 16</td> <td>24, 16</td>
<td><code>C3FA31687FB14AFE6EBB7BF5D87B574C</code></td> <td><code>6387AFED6602EEC4BE34FFABCB783146</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>40, 16</td> <td>40, 16</td>
<td><code>93548E81C9C9937BEF21FBBF00907EFF</code></td> <td><code>9181A50F01240CA85879086C850C6C58</code></td>
<td>Value received from server in Step 2</td> <td>Value received from server in Step 2</td>
</tr> </tr>
<tr> <tr>
<td>p</td> <td>p</td>
<td>56, 8</td> <td>56, 8</td>
<td><code>0459CAA235000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1506452021</td> <td><code>0449DBEA7F000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1239149183</td>
<td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td> <td>First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr> </tr>
<tr> <tr>
<td>q</td> <td>q</td>
<td>64, 8</td> <td>64, 8</td>
<td><code>046D31CF17000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1831980823</td> <td><code>046D72229B000000</code><br>TL byte deserialization <br>=&gt; bigendian conversion to decimal<br>=&gt; 1836196507</td>
<td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td> <td>Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding</td>
</tr> </tr>
<tr> <tr>
@ -393,7 +393,7 @@ random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915
<tr> <tr>
<td>encrypted_data</td> <td>encrypted_data</td>
<td>80, 260</td> <td>80, 260</td>
<td><code>FE000100060322C172A83BC12CFE35E0</code> <code>7606AB8D66671FEF502655CD9F071005</code> <code>6C1F0D1ECC01C45243FFF3609A97B133</code> <code>5687D4E82DB680B9A4C71B3FC0E0CDF2</code> <code>F1680B604AFE0BDE34A8D43CD1A52D4D</code> <code>7144FF87482141F4B96B390216483DBF</code> <code>7D393F502ED148BB030D463B52464E66</code> <code>89E280CF602DC7A5370AD9AC4407EEA6</code> <code>50FA631431B32B92381226A17122CFD0</code> <code>63C7B687D3A5BBAA120E234B891824D7</code> <code>20381E743297EEF9FE34D28DE82F506A</code> <code>D2FED78404AB7A27C6DF81ADCDB797C3</code> <code>EEA331C6883700DAC0E466B77DF36812</code> <code>F14A37F95A617C96C9C319AEED1D68DA</code> <code>2303EAFB4EFAA2BD36517BC044F10C5C</code> <code>2C8ECF5A2917FDFF06EBE9C4A4BE412D</code><br> <code>321AEDC1</code></td> <td><code>FE0001008731291CDD5513220A82626E</code> <code>9BE5FFBE1F760F72AA6D277BE83F2132</code> <code>B0734E46B518AADF0AC8E2348E1CCC34</code> <code>74C7F6F72C4874B2313DCF8F5E40C978</code> <code>B3317DB30872B428DE70FA6317DA068B</code> <code>31C428414AD03B8ACE80D222A48EA4AE</code> <code>A93D1AAB7B98B36820D68723F2110BEB</code> <code>EFA56EEEE1989226A902E2D0A7116D1F</code> <code>90E1CDBBE735C85948FD12AA010E94A6</code> <code>B8CA76B641EDA7D81571260D9B68D1C8</code> <code>DD23D3875255DFEC41C90B7FD00D08FD</code> <code>F4C1FF4EB91063D51790FE3F3B96E6FE</code> <code>9476D076A1ECB55E7ED1B9221353B9EA</code> <code>DDBDB1E71CBDE9E08B1211355CBEFD12</code> <code>D6350361515CBCF4991A280A40AD95A5</code> <code>F6F73DC24658580FFD89F29B65D5FDC0</code><br> <code>677F333E</code></td>
<td>Value generated above</td> <td>Value generated above</td>
</tr> </tr>
</tbody> </tbody>
@ -402,47 +402,47 @@ random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915
<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> <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 --> <!-- start server_DH_params_ok -->
<p>Received payload (excluding transport headers/trailers):</p> <p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 F4 47 F4 45 49 A1 66 <pre><code>0000 | 00 00 00 00 00 00 00 00 01 34 21 96 6E 4C A1 66
0010 | C0 02 00 00 5C 07 E8 D0 C3 FA 31 68 7F B1 4A FE 0010 | 78 02 00 00 5C 07 E8 D0 63 87 AF ED 66 02 EE C4
0020 | 6E BB 7B F5 D8 7B 57 4C 93 54 8E 81 C9 C9 93 7B 0020 | BE 34 FF AB CB 78 31 46 91 81 A5 0F 01 24 0C A8
0030 | EF 21 FB BF 00 90 7E FF FE 50 02 00 6A 39 36 56 0030 | 58 79 08 6C 85 0C 6C 58 FE 50 02 00 24 D0 29 7F
0040 | 63 7B 0E 06 03 AF 89 0D A2 16 7E 32 E3 ED 23 8B 0040 | B1 57 8E B5 7D 1B B0 90 DE 7D DB B0 84 CE B3 3A
0050 | 94 56 8C AB 84 8C 88 89 62 43 98 C3 71 35 7C A7 0050 | 48 CA 1A 7C D1 BD 38 AD B0 E7 CE 35 DE 20 7C 03
0060 | F7 8B 33 67 90 C7 3C BB FB 49 0D C2 38 0C 7A F4 0060 | 85 51 82 7B B7 A3 8A F8 53 88 AA A9 B6 4C 8A 7F
0070 | 9E 6D E4 0D D6 2A 24 AF 73 0F 13 9B 71 F8 FF D9 0070 | 28 E6 A0 B7 4A FE BD EB 11 91 1A 19 C7 7F 68 55
0080 | 73 43 06 59 76 83 86 AE 23 05 46 96 D4 FD E3 E5 0080 | 1F B0 BB 18 C2 B6 04 2E A0 44 3D 17 C7 59 A0 0F
0090 | 9D 9D 7D 89 A0 0A 6C 25 FF B3 F5 BF CE 9B 0D 7C 0090 | 88 E1 B9 19 D5 F6 13 61 72 75 C4 F7 14 B7 E3 E4
00A0 | 4C F1 36 48 86 91 F9 48 0C B4 9B FA 85 DF 22 6E 00A0 | 2C 13 46 CF 37 CF B7 E4 05 DC 83 52 21 DC 3B 8D
00B0 | CE 7D 31 27 88 55 A7 B5 24 E4 25 6C 08 AE 14 2B 00B0 | B4 FE CE 96 06 3C 5E B4 95 ED 1B 1D A2 A4 80 F4
00C0 | 14 43 42 63 3F 4B 27 A8 78 A0 7E 78 08 CF E6 57 00C0 | A1 F2 7C 28 5E 81 76 C4 18 8A 28 3A 0F 0B EE F9
00D0 | 18 73 7F 75 21 B4 0D BF 7B 6B 43 C8 50 4B 96 8C 00D0 | 09 3A 05 8F 3F 69 09 1C 39 E6 66 F0 97 BD 0B B2
00E0 | F1 7A F4 3C F9 85 71 E2 DA 71 82 D3 09 6F 68 3F 00E0 | AE 47 BC 46 CC EB 1B 95 6C 51 00 18 F6 27 D6 2C
00F0 | BC 23 0E D7 55 FA 0C 35 8F E5 13 77 08 CF CD DE 00F0 | 70 D2 B7 2B AC 7B 0B DC CE 18 7C 32 6D 66 45 8E
0100 | F4 0B FA 49 56 1E CE 35 32 F9 13 54 90 D9 B0 8E 0100 | E2 2E 63 15 9B E2 C1 A2 F7 75 63 D7 C3 F2 0F E8
0110 | 33 9E FE D4 63 89 D8 54 4B 99 C5 73 60 72 96 83 0110 | 88 FA FB B6 7B CB 18 BB AD 5B 49 18 48 D5 3B A9
0120 | 0A EB B6 FC F8 E0 38 75 A9 10 AE 1D 7F 86 5A A1 0120 | D8 4C D4 B8 31 F6 7F 44 7B DC 68 6C 9E B7 EE 7B
0130 | 34 9A F5 4D 3C 43 9A 8E 2E 65 39 71 53 02 BD 2F 0130 | 17 C9 C0 0D 42 6F C4 FB 12 7C D1 4D B4 2B F7 EA
0140 | 1E 3E 7F 72 E9 71 17 24 DE B9 69 FA D6 7F 12 C7 0140 | 05 2E D1 5D 9D 5E DF 2F C0 6A F1 75 B3 28 E6 A5
0150 | 7C AC C1 31 D0 F9 79 31 38 CA DA B8 AA 37 8C DD 0150 | 3A A6 B5 32 07 80 74 6C 7C 81 1A 50 23 5D E7 E3
0160 | 30 8C D5 F8 16 77 F4 61 69 B1 33 9F A8 2B 0B 22 0160 | 5D 08 E4 4D 52 2C 4A 17 63 B6 84 89 BD A3 6F B7
0170 | 6E 1E 0A F6 8F E7 83 66 97 F6 D0 4A E7 41 A8 BE 0170 | F6 0B FE 17 43 02 DC 72 50 DC 0F 0C 9A 8A 2A A9
0180 | C2 93 EE E7 13 DA D1 90 4E A3 AE D9 96 D2 B7 45 0180 | 65 2B DE 11 56 92 08 B8 24 53 9A 95 4C 12 EE 41
0190 | 51 0C B5 1B 4E 9F 4B 28 39 8E 18 9A AF E7 DC 04 0190 | C0 89 2D 80 E4 43 E2 0B E2 4A B3 65 76 F6 8C 67
01A0 | 61 C7 EC 37 50 17 88 69 41 DA 19 A4 46 CD 45 0C 01A0 | CC 90 36 0E 85 FC C1 92 55 2D C4 23 F6 BA 11 65
01B0 | 9A 10 70 F3 4C 5F E7 58 94 A9 55 54 13 26 88 1B 01B0 | F2 23 78 F8 B3 92 91 5F 89 1E DC 57 C1 5B 64 AC
01C0 | C0 60 9E B2 2D 83 E3 26 CE 0F 42 ED 0C 4E 25 E9 01C0 | 0B EF 3F 4E 07 5F 9C 4B EE FB 9A 4E F3 0E EB 4A
01D0 | 4D 57 6A 51 43 A8 49 92 57 E2 7F 27 04 C1 CF 2E 01D0 | 82 03 EE 60 51 10 9D 97 DE F1 47 B7 6C 42 AA B3
01E0 | 43 F7 72 35 31 DF F0 90 26 A3 94 3D F1 C8 72 F2 01E0 | C7 27 46 C4 D7 0E 26 48 AC 79 35 B7 21 AD 64 00
01F0 | 58 4B 4E 50 F0 F8 2F 70 6E 9C CE B5 43 F5 80 7C 01F0 | 9E C5 A5 19 DF 85 BA ED 49 0E EB CA C0 69 82 1D
0200 | 60 90 F5 9A 5C 17 11 AD 4D 15 F4 2B 35 5E 4D B2 0200 | 71 0F D1 65 7D D7 29 FC 5B 77 69 B8 7D 3E 90 17
0210 | 91 21 64 08 97 C0 E5 BA C1 6A C7 D7 B2 92 FF 4B 0210 | C9 0F 34 EF C1 39 3C A1 B1 E4 AC 2E FE 2D 53 E1
0220 | 0B 39 32 9F 75 A5 2F 12 6F 47 8D DB 61 07 3B 85 0220 | 58 E7 7A 8F ED 95 2B 66 27 81 B3 19 2F 44 47 EB
0230 | AD 16 35 6C E6 2C C6 EE EC 25 B6 B2 DA E3 6D 36 0230 | 44 C4 A8 C8 CA EC DA 02 63 FF 74 59 61 2D 53 0D
0240 | 9E 14 F2 55 B6 86 A5 A6 5C 89 B9 24 0F D4 80 AA 0240 | 4B F5 33 22 B4 4E 92 E0 2E A5 E8 4C C2 2B D7 C0
0250 | A3 09 64 3E D8 78 73 F1 B8 C7 6C 4D EA D3 2B 9B 0250 | 16 C8 1D F2 FA 98 DE BE B7 3D 5D 8A C8 D3 6D 03
0260 | 7D B2 EB 19 75 E3 22 B4 0B 13 35 D3 36 A2 A6 1D 0260 | 42 60 78 52 76 C2 61 69 A2 19 7A 74 07 C4 D3 53
0270 | AF BD FC 5D 08 97 D2 FD 53 2E 31 29 99 1E C3 B5 0270 | 27 EF 77 67 C5 C8 56 02 A2 09 34 12 15 D1 6D 00
0280 | 67 2E 75 EF 49 74 62 00 36 7F 59 E6</code></pre> 0280 | 78 6C E8 30 66 CF E3 B6 21 52 6E EF</code></pre>
<p>Payload (de)serialization:</p> <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> <pre><code>server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;</code></pre>
<table class="table"> <table class="table">
@ -464,13 +464,13 @@ random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915
<tr> <tr>
<td>message_id</td> <td>message_id</td>
<td>8, 8</td> <td>8, 8</td>
<td><code>01F447F44549A166</code></td> <td><code>013421966E4CA166</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> <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>
<tr> <tr>
<td>message_length</td> <td>message_length</td>
<td>16, 4</td> <td>16, 4</td>
<td><code>C0020000</code> (704 in decimal)</td> <td><code>78020000</code> (632 in decimal)</td>
<td>Message body length</td> <td>Message body length</td>
</tr> </tr>
<tr> <tr>
@ -482,19 +482,19 @@ random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>24, 16</td> <td>24, 16</td>
<td><code>C3FA31687FB14AFE6EBB7BF5D87B574C</code></td> <td><code>6387AFED6602EEC4BE34FFABCB783146</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>40, 16</td> <td>40, 16</td>
<td><code>93548E81C9C9937BEF21FBBF00907EFF</code></td> <td><code>9181A50F01240CA85879086C850C6C58</code></td>
<td>Value received from server in Step 2</td> <td>Value received from server in Step 2</td>
</tr> </tr>
<tr> <tr>
<td>encrypted_answer</td> <td>encrypted_answer</td>
<td>56, 596</td> <td>56, 596</td>
<td><code>FE5002006A393656637B0E0603AF890D</code> <code>A2167E32E3ED238B94568CAB848C8889</code> <code>624398C371357CA7F78B336790C73CBB</code> <code>FB490DC2380C7AF49E6DE40DD62A24AF</code> <code>730F139B71F8FFD973430659768386AE</code> <code>23054696D4FDE3E59D9D7D89A00A6C25</code> <code>FFB3F5BFCE9B0D7C4CF136488691F948</code> <code>0CB49BFA85DF226ECE7D31278855A7B5</code> <code>24E4256C08AE142B144342633F4B27A8</code> <code>78A07E7808CFE65718737F7521B40DBF</code> <code>7B6B43C8504B968CF17AF43CF98571E2</code> <code>DA7182D3096F683FBC230ED755FA0C35</code> <code>8FE5137708CFCDDEF40BFA49561ECE35</code> <code>32F9135490D9B08E339EFED46389D854</code> <code>4B99C573607296830AEBB6FCF8E03875</code> <code>A910AE1D7F865AA1349AF54D3C439A8E</code> <code>2E6539715302BD2F1E3E7F72E9711724</code> <code>DEB969FAD67F12C77CACC131D0F97931</code> <code>38CADAB8AA378CDD308CD5F81677F461</code> <code>69B1339FA82B0B226E1E0AF68FE78366</code> <code>97F6D04AE741A8BEC293EEE713DAD190</code> <code>4EA3AED996D2B745510CB51B4E9F4B28</code> <code>398E189AAFE7DC0461C7EC3750178869</code> <code>41DA19A446CD450C9A1070F34C5FE758</code> <code>94A955541326881BC0609EB22D83E326</code> <code>CE0F42ED0C4E25E94D576A5143A84992</code> <code>57E27F2704C1CF2E43F7723531DFF090</code> <code>26A3943DF1C872F2584B4E50F0F82F70</code> <code>6E9CCEB543F5807C6090F59A5C1711AD</code> <code>4D15F42B355E4DB29121640897C0E5BA</code> <code>C16AC7D7B292FF4B0B39329F75A52F12</code> <code>6F478DDB61073B85AD16356CE62CC6EE</code> <code>EC25B6B2DAE36D369E14F255B686A5A6</code> <code>5C89B9240FD480AAA309643ED87873F1</code> <code>B8C76C4DEAD32B9B7DB2EB1975E322B4</code> <code>0B1335D336A2A61DAFBDFC5D0897D2FD</code> <code>532E3129991EC3B5672E75EF49746200</code><br> <code>367F59E6</code></td> <td><code>FE50020024D0297FB1578EB57D1BB090</code> <code>DE7DDBB084CEB33A48CA1A7CD1BD38AD</code> <code>B0E7CE35DE207C038551827BB7A38AF8</code> <code>5388AAA9B64C8A7F28E6A0B74AFEBDEB</code> <code>11911A19C77F68551FB0BB18C2B6042E</code> <code>A0443D17C759A00F88E1B919D5F61361</code> <code>7275C4F714B7E3E42C1346CF37CFB7E4</code> <code>05DC835221DC3B8DB4FECE96063C5EB4</code> <code>95ED1B1DA2A480F4A1F27C285E8176C4</code> <code>188A283A0F0BEEF9093A058F3F69091C</code> <code>39E666F097BD0BB2AE47BC46CCEB1B95</code> <code>6C510018F627D62C70D2B72BAC7B0BDC</code> <code>CE187C326D66458EE22E63159BE2C1A2</code> <code>F77563D7C3F20FE888FAFBB67BCB18BB</code> <code>AD5B491848D53BA9D84CD4B831F67F44</code> <code>7BDC686C9EB7EE7B17C9C00D426FC4FB</code> <code>127CD14DB42BF7EA052ED15D9D5EDF2F</code> <code>C06AF175B328E6A53AA6B5320780746C</code> <code>7C811A50235DE7E35D08E44D522C4A17</code> <code>63B68489BDA36FB7F60BFE174302DC72</code> <code>50DC0F0C9A8A2AA9652BDE11569208B8</code> <code>24539A954C12EE41C0892D80E443E20B</code> <code>E24AB36576F68C67CC90360E85FCC192</code> <code>552DC423F6BA1165F22378F8B392915F</code> <code>891EDC57C15B64AC0BEF3F4E075F9C4B</code> <code>EEFB9A4EF30EEB4A8203EE6051109D97</code> <code>DEF147B76C42AAB3C72746C4D70E2648</code> <code>AC7935B721AD64009EC5A519DF85BAED</code> <code>490EEBCAC069821D710FD1657DD729FC</code> <code>5B7769B87D3E9017C90F34EFC1393CA1</code> <code>B1E4AC2EFE2D53E158E77A8FED952B66</code> <code>2781B3192F4447EB44C4A8C8CAECDA02</code> <code>63FF7459612D530D4BF53322B44E92E0</code> <code>2EA5E84CC22BD7C016C81DF2FA98DEBE</code> <code>B73D5D8AC8D36D034260785276C26169</code> <code>A2197A7407C4D35327EF7767C5C85602</code> <code>A209341215D16D00786CE83066CFE3B6</code><br> <code>21526EEF</code></td>
<td>See below</td> <td>See below</td>
</tr> </tr>
</tbody> </tbody>
@ -502,20 +502,20 @@ random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915
<!-- end server_DH_params_ok --> <!-- 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> <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 --> <!-- start server_DH_inner_data_input -->
<pre><code>encrypted_answer = 6A393656637B0E0603AF890DA2167E32E3ED238B94568CAB848C8889624398C371357CA7F78B336790C73CBBFB490DC2380C7AF49E6DE40DD62A24AF730F139B71F8FFD973430659768386AE23054696D4FDE3E59D9D7D89A00A6C25FFB3F5BFCE9B0D7C4CF136488691F9480CB49BFA85DF226ECE7D31278855A7B524E4256C08AE142B144342633F4B27A878A07E7808CFE65718737F7521B40DBF7B6B43C8504B968CF17AF43CF98571E2DA7182D3096F683FBC230ED755FA0C358FE5137708CFCDDEF40BFA49561ECE3532F9135490D9B08E339EFED46389D8544B99C573607296830AEBB6FCF8E03875A910AE1D7F865AA1349AF54D3C439A8E2E6539715302BD2F1E3E7F72E9711724DEB969FAD67F12C77CACC131D0F9793138CADAB8AA378CDD308CD5F81677F46169B1339FA82B0B226E1E0AF68FE7836697F6D04AE741A8BEC293EEE713DAD1904EA3AED996D2B745510CB51B4E9F4B28398E189AAFE7DC0461C7EC375017886941DA19A446CD450C9A1070F34C5FE75894A955541326881BC0609EB22D83E326CE0F42ED0C4E25E94D576A5143A8499257E27F2704C1CF2E43F7723531DFF09026A3943DF1C872F2584B4E50F0F82F706E9CCEB543F5807C6090F59A5C1711AD4D15F42B355E4DB29121640897C0E5BAC16AC7D7B292FF4B0B39329F75A52F126F478DDB61073B85AD16356CE62CC6EEEC25B6B2DAE36D369E14F255B686A5A65C89B9240FD480AAA309643ED87873F1B8C76C4DEAD32B9B7DB2EB1975E322B40B1335D336A2A61DAFBDFC5D0897D2FD532E3129991EC3B5672E75EF49746200367F59E6 <pre><code>encrypted_answer = 24D0297FB1578EB57D1BB090DE7DDBB084CEB33A48CA1A7CD1BD38ADB0E7CE35DE207C038551827BB7A38AF85388AAA9B64C8A7F28E6A0B74AFEBDEB11911A19C77F68551FB0BB18C2B6042EA0443D17C759A00F88E1B919D5F613617275C4F714B7E3E42C1346CF37CFB7E405DC835221DC3B8DB4FECE96063C5EB495ED1B1DA2A480F4A1F27C285E8176C4188A283A0F0BEEF9093A058F3F69091C39E666F097BD0BB2AE47BC46CCEB1B956C510018F627D62C70D2B72BAC7B0BDCCE187C326D66458EE22E63159BE2C1A2F77563D7C3F20FE888FAFBB67BCB18BBAD5B491848D53BA9D84CD4B831F67F447BDC686C9EB7EE7B17C9C00D426FC4FB127CD14DB42BF7EA052ED15D9D5EDF2FC06AF175B328E6A53AA6B5320780746C7C811A50235DE7E35D08E44D522C4A1763B68489BDA36FB7F60BFE174302DC7250DC0F0C9A8A2AA9652BDE11569208B824539A954C12EE41C0892D80E443E20BE24AB36576F68C67CC90360E85FCC192552DC423F6BA1165F22378F8B392915F891EDC57C15B64AC0BEF3F4E075F9C4BEEFB9A4EF30EEB4A8203EE6051109D97DEF147B76C42AAB3C72746C4D70E2648AC7935B721AD64009EC5A519DF85BAED490EEBCAC069821D710FD1657DD729FC5B7769B87D3E9017C90F34EFC1393CA1B1E4AC2EFE2D53E158E77A8FED952B662781B3192F4447EB44C4A8C8CAECDA0263FF7459612D530D4BF53322B44E92E02EA5E84CC22BD7C016C81DF2FA98DEBEB73D5D8AC8D36D034260785276C26169A2197A7407C4D35327EF7767C5C85602A209341215D16D00786CE83066CFE3B621526EEF
tmp_aes_key = 12E80C711D4E145929DBD59D74C4C9C784B465D36C86484EDB794E373343523A tmp_aes_key = 87A16D7D6F2AED65D4FDB26C6F77466043B2F2DB09F5CB131C091193BA7493A5
tmp_aes_iv = E46740B6386AD583BC7C143BDF4332C678F9CDC8EAB6EB4E602EBEF48E82B2E5</code></pre> tmp_aes_iv = 2EF58137AFB5123EADA871026C9DEB69207A69AD90ADC7FACA1570495E493CEC</code></pre>
<!-- end server_DH_inner_data_input --> <!-- end server_DH_inner_data_input -->
<p>Yielding:</p> <p>Yielding:</p>
<!-- start server_DH_inner_data_output --> <!-- start server_DH_inner_data_output -->
<pre><code>answer_with_hash = B3A14A01ED2A48826CB1A652B10DBF0B160345D3BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EFF03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE0001006F7B20B65478004B0FFAFBE7C96EA5EB35B8CED549CDF7C2B950F7E4B813DCF2F1E0566D7E2AB00D5F3AADE543648D2BE878EE9CBEB8ADA694580644339F1CC73FC96DB2028328EFB62AA8D9AFC68F7C58373382813B5C39228E3F1AF42B0150C9FA09F7CA96332360B7B021CF3B6C6F22B9F881593997C5EB9315F3504119A983A93BC2CBEB48EDAADEE189C2E2E1370A5E01172854E7B700A81E4DB92BF0BF8B836988C27502237F862B65C6E98C1A095E9699096347551F949284611DCBDC29428044AA7D31A09E4E25E1D4A064146085721B64E010AD51DAC6E5DFFAAC4E478636E596C044C50EF6495F2AFB70AA802884757F3F5DDA30CCF3AA4AD65CBE4549A166843F091D09114CAA <pre><code>answer_with_hash = AC0276C7739EEDE2111877BDA636E63A646074A1BA0D89B56387AFED6602EEC4BE34FFABCB7831469181A50F01240CA85879086C850C6C5803000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE00010061A54F355453D62BA850E1DEB2B9577E0ADFA00EF2B6A78426054AA8860885A2169064A4596EBF4CC332B564EC7594E841A8658355698A403EEF98C3D777919475A8311E62ECA435DBEC740F8BB8677C6A7650542872F24967352E83EEB889A44588DE6C8B380F7F69617EEE1C11344E3CB123DD27550D752E87567DED6E1CFE21ED4D517855E71E08BE0FC5144837BADB8CD899CA09E16C778CC9BDD7FC548D316F56EC204601F70E7C0103978014067D4BA5271C1D261CCCFA79CF5F6D6B47D768AABD844BB343A25341AD29BD9E705B1BB8EEDFEAE6AC6C775DB2B3324C4E02A84EFC1080DDB22B568C58FF05E633DD7D868EADC5DE69E44184964E260E146E4CA166B99604E76897DCB2
answer = BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EFF03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE0001006F7B20B65478004B0FFAFBE7C96EA5EB35B8CED549CDF7C2B950F7E4B813DCF2F1E0566D7E2AB00D5F3AADE543648D2BE878EE9CBEB8ADA694580644339F1CC73FC96DB2028328EFB62AA8D9AFC68F7C58373382813B5C39228E3F1AF42B0150C9FA09F7CA96332360B7B021CF3B6C6F22B9F881593997C5EB9315F3504119A983A93BC2CBEB48EDAADEE189C2E2E1370A5E01172854E7B700A81E4DB92BF0BF8B836988C27502237F862B65C6E98C1A095E9699096347551F949284611DCBDC29428044AA7D31A09E4E25E1D4A064146085721B64E010AD51DAC6E5DFFAAC4E478636E596C044C50EF6495F2AFB70AA802884757F3F5DDA30CCF3AA4AD65CBE4549A166843F091D09114CAA</code></pre> answer = BA0D89B56387AFED6602EEC4BE34FFABCB7831469181A50F01240CA85879086C850C6C5803000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE00010061A54F355453D62BA850E1DEB2B9577E0ADFA00EF2B6A78426054AA8860885A2169064A4596EBF4CC332B564EC7594E841A8658355698A403EEF98C3D777919475A8311E62ECA435DBEC740F8BB8677C6A7650542872F24967352E83EEB889A44588DE6C8B380F7F69617EEE1C11344E3CB123DD27550D752E87567DED6E1CFE21ED4D517855E71E08BE0FC5144837BADB8CD899CA09E16C778CC9BDD7FC548D316F56EC204601F70E7C0103978014067D4BA5271C1D261CCCFA79CF5F6D6B47D768AABD844BB343A25341AD29BD9E705B1BB8EEDFEAE6AC6C775DB2B3324C4E02A84EFC1080DDB22B568C58FF05E633DD7D868EADC5DE69E44184964E260E146E4CA166B99604E76897DCB2</code></pre>
<!-- end server_DH_inner_data_output --> <!-- end server_DH_inner_data_output -->
<!-- start server_DH_inner_data --> <!-- start server_DH_inner_data -->
<p>Generated payload (excluding transport headers/trailers):</p> <p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | BA 0D 89 B5 C3 FA 31 68 7F B1 4A FE 6E BB 7B F5 <pre><code>0000 | BA 0D 89 B5 63 87 AF ED 66 02 EE C4 BE 34 FF AB
0010 | D8 7B 57 4C 93 54 8E 81 C9 C9 93 7B EF 21 FB BF 0010 | CB 78 31 46 91 81 A5 0F 01 24 0C A8 58 79 08 6C
0020 | 00 90 7E FF 03 00 00 00 FE 00 01 00 C7 1C AE B9 0020 | 85 0C 6C 58 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 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 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 0050 | A7 C1 40 58 22 94 93 D2 25 30 F4 DB FA 33 6F 6E
@ -532,23 +532,23 @@ answer = BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EF
0100 | F4 7B F9 59 D9 56 85 0C E9 29 85 1F 0D 81 15 F6 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 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 0120 | 34 B1 04 03 11 9C D8 E3 B9 2F CC 5B FE 00 01 00
0130 | 6F 7B 20 B6 54 78 00 4B 0F FA FB E7 C9 6E A5 EB 0130 | 61 A5 4F 35 54 53 D6 2B A8 50 E1 DE B2 B9 57 7E
0140 | 35 B8 CE D5 49 CD F7 C2 B9 50 F7 E4 B8 13 DC F2 0140 | 0A DF A0 0E F2 B6 A7 84 26 05 4A A8 86 08 85 A2
0150 | F1 E0 56 6D 7E 2A B0 0D 5F 3A AD E5 43 64 8D 2B 0150 | 16 90 64 A4 59 6E BF 4C C3 32 B5 64 EC 75 94 E8
0160 | E8 78 EE 9C BE B8 AD A6 94 58 06 44 33 9F 1C C7 0160 | 41 A8 65 83 55 69 8A 40 3E EF 98 C3 D7 77 91 94
0170 | 3F C9 6D B2 02 83 28 EF B6 2A A8 D9 AF C6 8F 7C 0170 | 75 A8 31 1E 62 EC A4 35 DB EC 74 0F 8B B8 67 7C
0180 | 58 37 33 82 81 3B 5C 39 22 8E 3F 1A F4 2B 01 50 0180 | 6A 76 50 54 28 72 F2 49 67 35 2E 83 EE B8 89 A4
0190 | C9 FA 09 F7 CA 96 33 23 60 B7 B0 21 CF 3B 6C 6F 0190 | 45 88 DE 6C 8B 38 0F 7F 69 61 7E EE 1C 11 34 4E
01A0 | 22 B9 F8 81 59 39 97 C5 EB 93 15 F3 50 41 19 A9 01A0 | 3C B1 23 DD 27 55 0D 75 2E 87 56 7D ED 6E 1C FE
01B0 | 83 A9 3B C2 CB EB 48 ED AA DE E1 89 C2 E2 E1 37 01B0 | 21 ED 4D 51 78 55 E7 1E 08 BE 0F C5 14 48 37 BA
01C0 | 0A 5E 01 17 28 54 E7 B7 00 A8 1E 4D B9 2B F0 BF 01C0 | DB 8C D8 99 CA 09 E1 6C 77 8C C9 BD D7 FC 54 8D
01D0 | 8B 83 69 88 C2 75 02 23 7F 86 2B 65 C6 E9 8C 1A 01D0 | 31 6F 56 EC 20 46 01 F7 0E 7C 01 03 97 80 14 06
01E0 | 09 5E 96 99 09 63 47 55 1F 94 92 84 61 1D CB DC 01E0 | 7D 4B A5 27 1C 1D 26 1C CC FA 79 CF 5F 6D 6B 47
01F0 | 29 42 80 44 AA 7D 31 A0 9E 4E 25 E1 D4 A0 64 14 01F0 | D7 68 AA BD 84 4B B3 43 A2 53 41 AD 29 BD 9E 70
0200 | 60 85 72 1B 64 E0 10 AD 51 DA C6 E5 DF FA AC 4E 0200 | 5B 1B B8 EE DF EA E6 AC 6C 77 5D B2 B3 32 4C 4E
0210 | 47 86 36 E5 96 C0 44 C5 0E F6 49 5F 2A FB 70 AA 0210 | 02 A8 4E FC 10 80 DD B2 2B 56 8C 58 FF 05 E6 33
0220 | 80 28 84 75 7F 3F 5D DA 30 CC F3 AA 4A D6 5C BE 0220 | DD 7D 86 8E AD C5 DE 69 E4 41 84 96 4E 26 0E 14
0230 | 45 49 A1 66</code></pre> 0230 | 6E 4C A1 66</code></pre>
<p>Payload (de)serialization:</p> <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> <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"> <table class="table">
@ -570,13 +570,13 @@ answer = BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EF
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>4, 16</td> <td>4, 16</td>
<td><code>C3FA31687FB14AFE6EBB7BF5D87B574C</code></td> <td><code>6387AFED6602EEC4BE34FFABCB783146</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>20, 16</td> <td>20, 16</td>
<td><code>93548E81C9C9937BEF21FBBF00907EFF</code></td> <td><code>9181A50F01240CA85879086C850C6C58</code></td>
<td>Value received from server in Step 2</td> <td>Value received from server in Step 2</td>
</tr> </tr>
<tr> <tr>
@ -594,13 +594,13 @@ answer = BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EF
<tr> <tr>
<td>g_a</td> <td>g_a</td>
<td>300, 260</td> <td>300, 260</td>
<td><code>FE0001006F7B20B65478004B0FFAFBE7</code> <code>C96EA5EB35B8CED549CDF7C2B950F7E4</code> <code>B813DCF2F1E0566D7E2AB00D5F3AADE5</code> <code>43648D2BE878EE9CBEB8ADA694580644</code> <code>339F1CC73FC96DB2028328EFB62AA8D9</code> <code>AFC68F7C58373382813B5C39228E3F1A</code> <code>F42B0150C9FA09F7CA96332360B7B021</code> <code>CF3B6C6F22B9F881593997C5EB9315F3</code> <code>504119A983A93BC2CBEB48EDAADEE189</code> <code>C2E2E1370A5E01172854E7B700A81E4D</code> <code>B92BF0BF8B836988C27502237F862B65</code> <code>C6E98C1A095E9699096347551F949284</code> <code>611DCBDC29428044AA7D31A09E4E25E1</code> <code>D4A064146085721B64E010AD51DAC6E5</code> <code>DFFAAC4E478636E596C044C50EF6495F</code> <code>2AFB70AA802884757F3F5DDA30CCF3AA</code><br> <code>4AD65CBE</code></td> <td><code>FE00010061A54F355453D62BA850E1DE</code> <code>B2B9577E0ADFA00EF2B6A78426054AA8</code> <code>860885A2169064A4596EBF4CC332B564</code> <code>EC7594E841A8658355698A403EEF98C3</code> <code>D777919475A8311E62ECA435DBEC740F</code> <code>8BB8677C6A7650542872F24967352E83</code> <code>EEB889A44588DE6C8B380F7F69617EEE</code> <code>1C11344E3CB123DD27550D752E87567D</code> <code>ED6E1CFE21ED4D517855E71E08BE0FC5</code> <code>144837BADB8CD899CA09E16C778CC9BD</code> <code>D7FC548D316F56EC204601F70E7C0103</code> <code>978014067D4BA5271C1D261CCCFA79CF</code> <code>5F6D6B47D768AABD844BB343A25341AD</code> <code>29BD9E705B1BB8EEDFEAE6AC6C775DB2</code> <code>B3324C4E02A84EFC1080DDB22B568C58</code> <code>FF05E633DD7D868EADC5DE69E4418496</code><br> <code>4E260E14</code></td>
<td><code>g_a</code> diffie-hellman parameter</td> <td><code>g_a</code> diffie-hellman parameter</td>
</tr> </tr>
<tr> <tr>
<td>server_time</td> <td>server_time</td>
<td>560, 4</td> <td>560, 4</td>
<td><code>4549A166</code> (1721846085 in decimal)</td> <td><code>6E4CA166</code> (1721846894 in decimal)</td>
<td>Server time</td> <td>Server time</td>
</tr> </tr>
</tbody> </tbody>
@ -609,34 +609,34 @@ answer = BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EF
<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> <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> <p>First, generate a secure random 2048-bit number b:</p>
<!-- start b --> <!-- start b -->
<pre><code>b = AB2EB055179E334D17B7EC7E62484A8D586449EE0CCBAE778158632715172B3242B86DDC88802ADF21E68910394A465818320374D839831869F333B504B725F3F28F38D6FE8099463F18FB32532718B2ECD57382199E14A539E441D2E50EFA2F81B8EF41B29B043E756A2DE044BF89D2F642DF510BF16EE9F460E6CB95A72B7CB2E1B6769159E379AA74055D3C28E304F23D58BA3B431844C962DB1094C9E1EA5E9E0172E8C864F0C5AE1E5C24877C8108D0971CCA80CC647444A52A0427B7FB11CF9FC03201ACBC409E8C2F1E5B9D20BBADA60E5A711DABFE191E7BBBC60403292A7D3F75725B72898D822D25690D67956787B5CE6328689029E483094526E5</code></pre> <pre><code>b = AF7377821F4A9AD25A2BA317730937A3852EC889E1EE846D52D8847A731DD1EB1625F623DDA1EAF34E96B6B5734D036A4A635EA7DCCC5A413DEE6DF0FE00BF555215612BC3092F68859788BE46C9672AD4EEF080B297AEBA45FED1C6821A0764CFCEDF2FBB8CFD21C0F2A7A9DF24586610CAA82763FDD6E236601C4080B3E44671DEB8486CEFDD53CA18A3008466ACF7B746CB5AB67026B2E791CA535A7A1ED8E87E762400360E1DECE1AA9F117CCAF9492354661B2F8A869F3D5D182CC8538366167512F8FCA58A54E9179D88E415DC57826D7BE026AB623106298EA0D9B01DE8D1A36DECB903B006787E7899E72DD7D4FEF2EAE08684039CF2F6381D5ED5F2</code></pre>
<!-- end b --> <!-- end b -->
<p>Then compute <code>g_b = pow(g, b) mod dh_prime</code></p> <p>Then compute <code>g_b = pow(g, b) mod dh_prime</code></p>
<!-- start g_b --> <!-- start g_b -->
<pre><code>g_b = 64294D850864834E4E34CA5B05E8999B469C131BF388CC9048AE632F46BC1F0BD2CFD88CD9D20D88672D6D01650E5138A9D3F9FB091D5828C4C0A6398524F0A0DB7B3DE7D8E1C884000E23294B2D684180A5F796DE64760FA723460B79C7C3862D163656B121F4522C5845F00290EC91B89BFBF08C6E80E957D35F33B3004169A47C4C546E704DE6B0EF7668C55D86CD1DBC327A86AB597ECF7846789A2DC5E1E153994C0DED01D3DAE773359E3F3A0BE41EA65163BE2B52C4CB8E1248E82B6FB09B89929BCFDEF2786E40345CE67895251F874E0B3EE7661B8FDE81162129699731034E8915F04DF1493D6C73CC0BDFC404C5BA0E2AEFBC11B8B817C5D4670E</code></pre> <pre><code>g_b = 1CA04FBD754009365B8FF282703B55FA9F7D69CB6A2CE521C355F750865FB2A2F75B2788FDB3B19ACA8F7C25334D042E8D9363181E01844D6B573B45A53172E29025E53BA90749951B1CE528DCDBC30BADF95340BAB141050864D02529D81136CCE69F88DCEDEA0AD9251E5D8F57C2B1EFC873C2993B635484C2E83807D7833A4DF6AEE22D614651452DB36F4A0ABE5A5C679CCD88CA874290672DC71644B5FC6D374BA3F4C9976860D6F5CCC50E66E3F30DDBA74AF340FC3629E99863E40903C42BFFDEAC80F2524543DD0887D0FFFBFACE0775B7EC64F4F5452C800DAFE4A2A342229EA3234A0838910A3E52D6CF8CA0C83D7612863174688F341E5E9169DA</code></pre>
<!-- end g_b --> <!-- end g_b -->
<h6>7.1) generation of encrypted_data</h6> <h6>7.1) generation of encrypted_data</h6>
<!-- start client_DH_inner_data --> <!-- start client_DH_inner_data -->
<p>Generated payload (excluding transport headers/trailers):</p> <p>Generated payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 54 B6 43 66 C3 FA 31 68 7F B1 4A FE 6E BB 7B F5 <pre><code>0000 | 54 B6 43 66 63 87 AF ED 66 02 EE C4 BE 34 FF AB
0010 | D8 7B 57 4C 93 54 8E 81 C9 C9 93 7B EF 21 FB BF 0010 | CB 78 31 46 91 81 A5 0F 01 24 0C A8 58 79 08 6C
0020 | 00 90 7E FF 00 00 00 00 00 00 00 00 FE 00 01 00 0020 | 85 0C 6C 58 00 00 00 00 00 00 00 00 FE 00 01 00
0030 | 64 29 4D 85 08 64 83 4E 4E 34 CA 5B 05 E8 99 9B 0030 | 1C A0 4F BD 75 40 09 36 5B 8F F2 82 70 3B 55 FA
0040 | 46 9C 13 1B F3 88 CC 90 48 AE 63 2F 46 BC 1F 0B 0040 | 9F 7D 69 CB 6A 2C E5 21 C3 55 F7 50 86 5F B2 A2
0050 | D2 CF D8 8C D9 D2 0D 88 67 2D 6D 01 65 0E 51 38 0050 | F7 5B 27 88 FD B3 B1 9A CA 8F 7C 25 33 4D 04 2E
0060 | A9 D3 F9 FB 09 1D 58 28 C4 C0 A6 39 85 24 F0 A0 0060 | 8D 93 63 18 1E 01 84 4D 6B 57 3B 45 A5 31 72 E2
0070 | DB 7B 3D E7 D8 E1 C8 84 00 0E 23 29 4B 2D 68 41 0070 | 90 25 E5 3B A9 07 49 95 1B 1C E5 28 DC DB C3 0B
0080 | 80 A5 F7 96 DE 64 76 0F A7 23 46 0B 79 C7 C3 86 0080 | AD F9 53 40 BA B1 41 05 08 64 D0 25 29 D8 11 36
0090 | 2D 16 36 56 B1 21 F4 52 2C 58 45 F0 02 90 EC 91 0090 | CC E6 9F 88 DC ED EA 0A D9 25 1E 5D 8F 57 C2 B1
00A0 | B8 9B FB F0 8C 6E 80 E9 57 D3 5F 33 B3 00 41 69 00A0 | EF C8 73 C2 99 3B 63 54 84 C2 E8 38 07 D7 83 3A
00B0 | A4 7C 4C 54 6E 70 4D E6 B0 EF 76 68 C5 5D 86 CD 00B0 | 4D F6 AE E2 2D 61 46 51 45 2D B3 6F 4A 0A BE 5A
00C0 | 1D BC 32 7A 86 AB 59 7E CF 78 46 78 9A 2D C5 E1 00C0 | 5C 67 9C CD 88 CA 87 42 90 67 2D C7 16 44 B5 FC
00D0 | E1 53 99 4C 0D ED 01 D3 DA E7 73 35 9E 3F 3A 0B 00D0 | 6D 37 4B A3 F4 C9 97 68 60 D6 F5 CC C5 0E 66 E3
00E0 | E4 1E A6 51 63 BE 2B 52 C4 CB 8E 12 48 E8 2B 6F 00E0 | F3 0D DB A7 4A F3 40 FC 36 29 E9 98 63 E4 09 03
00F0 | B0 9B 89 92 9B CF DE F2 78 6E 40 34 5C E6 78 95 00F0 | C4 2B FF DE AC 80 F2 52 45 43 DD 08 87 D0 FF FB
0100 | 25 1F 87 4E 0B 3E E7 66 1B 8F DE 81 16 21 29 69 0100 | FA CE 07 75 B7 EC 64 F4 F5 45 2C 80 0D AF E4 A2
0110 | 97 31 03 4E 89 15 F0 4D F1 49 3D 6C 73 CC 0B DF 0110 | A3 42 22 9E A3 23 4A 08 38 91 0A 3E 52 D6 CF 8C
0120 | C4 04 C5 BA 0E 2A EF BC 11 B8 B8 17 C5 D4 67 0E</code></pre> 0120 | A0 C8 3D 76 12 86 31 74 68 8F 34 1E 5E 91 69 DA</code></pre>
<p>Payload (de)serialization:</p> <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> <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"> <table class="table">
@ -658,19 +658,19 @@ answer = BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EF
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>4, 16</td> <td>4, 16</td>
<td><code>C3FA31687FB14AFE6EBB7BF5D87B574C</code></td> <td><code>6387AFED6602EEC4BE34FFABCB783146</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>20, 16</td> <td>20, 16</td>
<td><code>93548E81C9C9937BEF21FBBF00907EFF</code></td> <td><code>9181A50F01240CA85879086C850C6C58</code></td>
<td>Value received from server in Step 2</td> <td>Value received from server in Step 2</td>
</tr> </tr>
<tr> <tr>
<td>g_b</td> <td>g_b</td>
<td>36, 260</td> <td>36, 260</td>
<td><code>FE00010064294D850864834E4E34CA5B</code> <code>05E8999B469C131BF388CC9048AE632F</code> <code>46BC1F0BD2CFD88CD9D20D88672D6D01</code> <code>650E5138A9D3F9FB091D5828C4C0A639</code> <code>8524F0A0DB7B3DE7D8E1C884000E2329</code> <code>4B2D684180A5F796DE64760FA723460B</code> <code>79C7C3862D163656B121F4522C5845F0</code> <code>0290EC91B89BFBF08C6E80E957D35F33</code> <code>B3004169A47C4C546E704DE6B0EF7668</code> <code>C55D86CD1DBC327A86AB597ECF784678</code> <code>9A2DC5E1E153994C0DED01D3DAE77335</code> <code>9E3F3A0BE41EA65163BE2B52C4CB8E12</code> <code>48E82B6FB09B89929BCFDEF2786E4034</code> <code>5CE67895251F874E0B3EE7661B8FDE81</code> <code>162129699731034E8915F04DF1493D6C</code> <code>73CC0BDFC404C5BA0E2AEFBC11B8B817</code><br> <code>C5D4670E</code></td> <td><code>FE0001001CA04FBD754009365B8FF282</code> <code>703B55FA9F7D69CB6A2CE521C355F750</code> <code>865FB2A2F75B2788FDB3B19ACA8F7C25</code> <code>334D042E8D9363181E01844D6B573B45</code> <code>A53172E29025E53BA90749951B1CE528</code> <code>DCDBC30BADF95340BAB141050864D025</code> <code>29D81136CCE69F88DCEDEA0AD9251E5D</code> <code>8F57C2B1EFC873C2993B635484C2E838</code> <code>07D7833A4DF6AEE22D614651452DB36F</code> <code>4A0ABE5A5C679CCD88CA874290672DC7</code> <code>1644B5FC6D374BA3F4C9976860D6F5CC</code> <code>C50E66E3F30DDBA74AF340FC3629E998</code> <code>63E40903C42BFFDEAC80F2524543DD08</code> <code>87D0FFFBFACE0775B7EC64F4F5452C80</code> <code>0DAFE4A2A342229EA3234A0838910A3E</code> <code>52D6CF8CA0C83D7612863174688F341E</code><br> <code>5E9169DA</code></td>
<td>Single-byte prefix denoting length, a 256-byte (2048-bit) string, and zero bytes of padding</td> <td>Single-byte prefix denoting length, a 256-byte (2048-bit) string, and zero bytes of padding</td>
</tr> </tr>
<tr> <tr>
@ -684,47 +684,47 @@ answer = BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EF
<!-- end client_DH_inner_data --> <!-- 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> <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 --> <!-- start client_DH_inner_data_input -->
<pre><code>data = 54B64366C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EFF0000000000000000FE00010064294D850864834E4E34CA5B05E8999B469C131BF388CC9048AE632F46BC1F0BD2CFD88CD9D20D88672D6D01650E5138A9D3F9FB091D5828C4C0A6398524F0A0DB7B3DE7D8E1C884000E23294B2D684180A5F796DE64760FA723460B79C7C3862D163656B121F4522C5845F00290EC91B89BFBF08C6E80E957D35F33B3004169A47C4C546E704DE6B0EF7668C55D86CD1DBC327A86AB597ECF7846789A2DC5E1E153994C0DED01D3DAE773359E3F3A0BE41EA65163BE2B52C4CB8E1248E82B6FB09B89929BCFDEF2786E40345CE67895251F874E0B3EE7661B8FDE81162129699731034E8915F04DF1493D6C73CC0BDFC404C5BA0E2AEFBC11B8B817C5D4670E <pre><code>data = 54B643666387AFED6602EEC4BE34FFABCB7831469181A50F01240CA85879086C850C6C580000000000000000FE0001001CA04FBD754009365B8FF282703B55FA9F7D69CB6A2CE521C355F750865FB2A2F75B2788FDB3B19ACA8F7C25334D042E8D9363181E01844D6B573B45A53172E29025E53BA90749951B1CE528DCDBC30BADF95340BAB141050864D02529D81136CCE69F88DCEDEA0AD9251E5D8F57C2B1EFC873C2993B635484C2E83807D7833A4DF6AEE22D614651452DB36F4A0ABE5A5C679CCD88CA874290672DC71644B5FC6D374BA3F4C9976860D6F5CCC50E66E3F30DDBA74AF340FC3629E99863E40903C42BFFDEAC80F2524543DD0887D0FFFBFACE0775B7EC64F4F5452C800DAFE4A2A342229EA3234A0838910A3E52D6CF8CA0C83D7612863174688F341E5E9169DA
padding = 8DF91167272E406E5A93395C padding = 7D41867F9FBED9344D62FB68
tmp_aes_key = 12E80C711D4E145929DBD59D74C4C9C784B465D36C86484EDB794E373343523A tmp_aes_key = 87A16D7D6F2AED65D4FDB26C6F77466043B2F2DB09F5CB131C091193BA7493A5
tmp_aes_iv = E46740B6386AD583BC7C143BDF4332C678F9CDC8EAB6EB4E602EBEF48E82B2E5</code></pre> tmp_aes_iv = 2EF58137AFB5123EADA871026C9DEB69207A69AD90ADC7FACA1570495E493CEC</code></pre>
<!-- end client_DH_inner_data_input --> <!-- end client_DH_inner_data_input -->
<p>Process:</p> <p>Process:</p>
<pre><code>data_with_hash := SHA1(data) + data + padding (0-15 random bytes such that total length is divisible by 16) <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> encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);</code></pre>
<p>Output:</p> <p>Output:</p>
<!-- start client_DH_inner_data_output --> <!-- start client_DH_inner_data_output -->
<pre><code>encrypted_data = C9E9C04B8D4F439A80A87AA9AAAE846464EEBA70FCD941D99B8189A9F825C85647EF27A9D73A085D98F864A321D16823DB15684D9576B3CC0E5CB0DCC520A18BC7851C926657CEF82E93DBF1238CADE8854C274FABFEED6C34687335131E7A1DAFAB9DA83D940E33D65C6D15518A15540C48E1335F855241D58ABB4E20B763318847DE93FCC651E039CAC3868895DC400DD7DC9DC36D75AA0638C63B84F8B40AA6E9A25BB48A42425F772D001782D97357EC3946AEBEA16426FB2C4BECD8BD30125AE25644576BC59B53385F299D69AE4245D3D811E335439A5F09C989D58F85B5C8E10977219F071578E141A568D5D98D1E174BAE85602E3B89D8AB26BA19492EEA9CBEF5164FA553CD472F15B411796084972BAC0331B835B952E5E02C50DE5BA2E2EB3F3F33D6C3B6ACD005B79E4BACEA665490DA5FCED36D7305F9756ADAE17F1391B170203702C97083AEE08F14</code></pre> <pre><code>encrypted_data = 128050427D220458D6D465483BD6792A75C2B14E84C610B3F6DD61C61D726D602F62BD7271C61C6D535A72AF63DFA8CCC375D246D9E64D985DCEA9C2A42CF76C2BEC2A275B578EFD27B054ABF7C088FEDBEA46C3DA5AD096B09C6B1E4256A08D37ECE8F6EE7B47B142AE7DA9816D41587471D443197ECCF0683AB25EAD6A2FDD696D6D752EAF2A12865AA504CBA16B7F39A18B9BAAE6103F539B56FA7D49D16E944041DDA3468F895FAA157164A7269A22D1EFD825F6BB01F0C784FA78E52182146AF568D6825818359C70EAA655C59019B534DC7F96B4D8A75589859B41BBD93624095D1A3D1BB4DBAAB42949F0E76627F4BB838BAC71AADA4A545496490C5DCBB4AE9397D89B837B00A01A2BD7961CF50E7F8A6FD804475E28F76E5006462F69C8989C2B0D1665D0542DE9BD04C70F165885F4DA49997199866990492C7B652FE2729BA002F4967CB4980844249F82</code></pre>
<!-- end client_DH_inner_data_output --> <!-- end client_DH_inner_data_output -->
<p>The length of the final string is 336 bytes.</p> <p>The length of the final string is 336 bytes.</p>
<h6>7.2) set_client_DH_params query</h6> <h6>7.2) set_client_DH_params query</h6>
<!-- start set_client_DH_params --> <!-- start set_client_DH_params -->
<p>Sent payload (excluding transport headers/trailers):</p> <p>Sent payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 1C 6F 0E 00 45 49 A1 66 <pre><code>0000 | 00 00 00 00 00 00 00 00 F4 28 0E 00 6E 4C A1 66
0010 | 78 01 00 00 1F 5F 04 F5 C3 FA 31 68 7F B1 4A FE 0010 | 78 01 00 00 1F 5F 04 F5 63 87 AF ED 66 02 EE C4
0020 | 6E BB 7B F5 D8 7B 57 4C 93 54 8E 81 C9 C9 93 7B 0020 | BE 34 FF AB CB 78 31 46 91 81 A5 0F 01 24 0C A8
0030 | EF 21 FB BF 00 90 7E FF FE 50 01 00 C9 E9 C0 4B 0030 | 58 79 08 6C 85 0C 6C 58 FE 50 01 00 12 80 50 42
0040 | 8D 4F 43 9A 80 A8 7A A9 AA AE 84 64 64 EE BA 70 0040 | 7D 22 04 58 D6 D4 65 48 3B D6 79 2A 75 C2 B1 4E
0050 | FC D9 41 D9 9B 81 89 A9 F8 25 C8 56 47 EF 27 A9 0050 | 84 C6 10 B3 F6 DD 61 C6 1D 72 6D 60 2F 62 BD 72
0060 | D7 3A 08 5D 98 F8 64 A3 21 D1 68 23 DB 15 68 4D 0060 | 71 C6 1C 6D 53 5A 72 AF 63 DF A8 CC C3 75 D2 46
0070 | 95 76 B3 CC 0E 5C B0 DC C5 20 A1 8B C7 85 1C 92 0070 | D9 E6 4D 98 5D CE A9 C2 A4 2C F7 6C 2B EC 2A 27
0080 | 66 57 CE F8 2E 93 DB F1 23 8C AD E8 85 4C 27 4F 0080 | 5B 57 8E FD 27 B0 54 AB F7 C0 88 FE DB EA 46 C3
0090 | AB FE ED 6C 34 68 73 35 13 1E 7A 1D AF AB 9D A8 0090 | DA 5A D0 96 B0 9C 6B 1E 42 56 A0 8D 37 EC E8 F6
00A0 | 3D 94 0E 33 D6 5C 6D 15 51 8A 15 54 0C 48 E1 33 00A0 | EE 7B 47 B1 42 AE 7D A9 81 6D 41 58 74 71 D4 43
00B0 | 5F 85 52 41 D5 8A BB 4E 20 B7 63 31 88 47 DE 93 00B0 | 19 7E CC F0 68 3A B2 5E AD 6A 2F DD 69 6D 6D 75
00C0 | FC C6 51 E0 39 CA C3 86 88 95 DC 40 0D D7 DC 9D 00C0 | 2E AF 2A 12 86 5A A5 04 CB A1 6B 7F 39 A1 8B 9B
00D0 | C3 6D 75 AA 06 38 C6 3B 84 F8 B4 0A A6 E9 A2 5B 00D0 | AA E6 10 3F 53 9B 56 FA 7D 49 D1 6E 94 40 41 DD
00E0 | B4 8A 42 42 5F 77 2D 00 17 82 D9 73 57 EC 39 46 00E0 | A3 46 8F 89 5F AA 15 71 64 A7 26 9A 22 D1 EF D8
00F0 | AE BE A1 64 26 FB 2C 4B EC D8 BD 30 12 5A E2 56 00F0 | 25 F6 BB 01 F0 C7 84 FA 78 E5 21 82 14 6A F5 68
0100 | 44 57 6B C5 9B 53 38 5F 29 9D 69 AE 42 45 D3 D8 0100 | D6 82 58 18 35 9C 70 EA A6 55 C5 90 19 B5 34 DC
0110 | 11 E3 35 43 9A 5F 09 C9 89 D5 8F 85 B5 C8 E1 09 0110 | 7F 96 B4 D8 A7 55 89 85 9B 41 BB D9 36 24 09 5D
0120 | 77 21 9F 07 15 78 E1 41 A5 68 D5 D9 8D 1E 17 4B 0120 | 1A 3D 1B B4 DB AA B4 29 49 F0 E7 66 27 F4 BB 83
0130 | AE 85 60 2E 3B 89 D8 AB 26 BA 19 49 2E EA 9C BE 0130 | 8B AC 71 AA DA 4A 54 54 96 49 0C 5D CB B4 AE 93
0140 | F5 16 4F A5 53 CD 47 2F 15 B4 11 79 60 84 97 2B 0140 | 97 D8 9B 83 7B 00 A0 1A 2B D7 96 1C F5 0E 7F 8A
0150 | AC 03 31 B8 35 B9 52 E5 E0 2C 50 DE 5B A2 E2 EB 0150 | 6F D8 04 47 5E 28 F7 6E 50 06 46 2F 69 C8 98 9C
0160 | 3F 3F 33 D6 C3 B6 AC D0 05 B7 9E 4B AC EA 66 54 0160 | 2B 0D 16 65 D0 54 2D E9 BD 04 C7 0F 16 58 85 F4
0170 | 90 DA 5F CE D3 6D 73 05 F9 75 6A DA E1 7F 13 91 0170 | DA 49 99 71 99 86 69 90 49 2C 7B 65 2F E2 72 9B
0180 | B1 70 20 37 02 C9 70 83 AE E0 8F 14</code></pre> 0180 | A0 02 F4 96 7C B4 98 08 44 24 9F 82</code></pre>
<p>Payload (de)serialization:</p> <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> <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"> <table class="table">
@ -746,7 +746,7 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr> <tr>
<td>message_id</td> <td>message_id</td>
<td>8, 8</td> <td>8, 8</td>
<td><code>1C6F0E004549A166</code></td> <td><code>F4280E006E4CA166</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> <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>
<tr> <tr>
@ -764,19 +764,19 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>24, 16</td> <td>24, 16</td>
<td><code>C3FA31687FB14AFE6EBB7BF5D87B574C</code></td> <td><code>6387AFED6602EEC4BE34FFABCB783146</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>40, 16</td> <td>40, 16</td>
<td><code>93548E81C9C9937BEF21FBBF00907EFF</code></td> <td><code>9181A50F01240CA85879086C850C6C58</code></td>
<td>Value received from server in Step 2</td> <td>Value received from server in Step 2</td>
</tr> </tr>
<tr> <tr>
<td>encrypted_data</td> <td>encrypted_data</td>
<td>56, 340</td> <td>56, 340</td>
<td><code>FE500100C9E9C04B8D4F439A80A87AA9</code> <code>AAAE846464EEBA70FCD941D99B8189A9</code> <code>F825C85647EF27A9D73A085D98F864A3</code> <code>21D16823DB15684D9576B3CC0E5CB0DC</code> <code>C520A18BC7851C926657CEF82E93DBF1</code> <code>238CADE8854C274FABFEED6C34687335</code> <code>131E7A1DAFAB9DA83D940E33D65C6D15</code> <code>518A15540C48E1335F855241D58ABB4E</code> <code>20B763318847DE93FCC651E039CAC386</code> <code>8895DC400DD7DC9DC36D75AA0638C63B</code> <code>84F8B40AA6E9A25BB48A42425F772D00</code> <code>1782D97357EC3946AEBEA16426FB2C4B</code> <code>ECD8BD30125AE25644576BC59B53385F</code> <code>299D69AE4245D3D811E335439A5F09C9</code> <code>89D58F85B5C8E10977219F071578E141</code> <code>A568D5D98D1E174BAE85602E3B89D8AB</code> <code>26BA19492EEA9CBEF5164FA553CD472F</code> <code>15B411796084972BAC0331B835B952E5</code> <code>E02C50DE5BA2E2EB3F3F33D6C3B6ACD0</code> <code>05B79E4BACEA665490DA5FCED36D7305</code> <code>F9756ADAE17F1391B170203702C97083</code><br> <code>AEE08F14</code></td> <td><code>FE500100128050427D220458D6D46548</code> <code>3BD6792A75C2B14E84C610B3F6DD61C6</code> <code>1D726D602F62BD7271C61C6D535A72AF</code> <code>63DFA8CCC375D246D9E64D985DCEA9C2</code> <code>A42CF76C2BEC2A275B578EFD27B054AB</code> <code>F7C088FEDBEA46C3DA5AD096B09C6B1E</code> <code>4256A08D37ECE8F6EE7B47B142AE7DA9</code> <code>816D41587471D443197ECCF0683AB25E</code> <code>AD6A2FDD696D6D752EAF2A12865AA504</code> <code>CBA16B7F39A18B9BAAE6103F539B56FA</code> <code>7D49D16E944041DDA3468F895FAA1571</code> <code>64A7269A22D1EFD825F6BB01F0C784FA</code> <code>78E52182146AF568D6825818359C70EA</code> <code>A655C59019B534DC7F96B4D8A7558985</code> <code>9B41BBD93624095D1A3D1BB4DBAAB429</code> <code>49F0E76627F4BB838BAC71AADA4A5454</code> <code>96490C5DCBB4AE9397D89B837B00A01A</code> <code>2BD7961CF50E7F8A6FD804475E28F76E</code> <code>5006462F69C8989C2B0D1665D0542DE9</code> <code>BD04C70F165885F4DA49997199866990</code> <code>492C7B652FE2729BA002F4967CB49808</code><br> <code>44249F82</code></td>
<td>Encrypted client_DH_inner_data generated previously, serialized as a TL byte string</td> <td>Encrypted client_DH_inner_data generated previously, serialized as a TL byte string</td>
</tr> </tr>
</tbody> </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> <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> <p>The client computes the auth_key using formula <code>g_a^b mod dh_prime</code>:</p>
<!-- start auth_key --> <!-- start auth_key -->
<pre><code>auth_key = A065B2F30D9858452D2EB37BC81FA871BED25C11A31619CAFEAAC43658B8119CF5BDA5AB5904F6B50B71ACE7B6A8F7C1DA1536EED58264DEA994B9BA0374E37EA71C4BA46A108CEC9385C08E78E2080F26A995D54CBC035449029FB026AADDF157D4D85319E16E5D8DCD40A038A4600512A15432CF017BCAEC020E7D290A7D0BD4143F0211B2D660AEFEB399E9AF6B4912CCF68D368A289E18B784528ABAB310F58A8D6EA9525F99BDF8C142D616CEBB3EF5E74C6CF3B9D1453D2D82816D06EEF67CAD8F72C5E3892AFDBB542C2F357FC3DA0783A491A00E4B60510990DD9A77586FED0B1A1ECF8D3473DDBBCAD08F22501E6611E7E0D7EB0440CEA5816AE8D4</code></pre> <pre><code>auth_key = 41BF02FB10F92AC40FC93D22820D05D943FAAFDC3D5B03F814409357751ABDCE81334CCD6BBDF5EBF0BCB127ED1989FA40D52C45C93C0CA4120A299E23BEEDA657ABDD4495CED827F3E87AA7DC13804EE1C80DE61DDAE5B28357450AA42D2D00600A5A354BC1936A55A337103342E9A4809839EE69CF01B36DCEAAC03815AA2C681261581ECE75E2F4AC5C32733966A5F25F0822A6233B8EC464F4415F9862F04A51D6D42662DDFBB2CE40735A80DEA7023325216DE430FC470B8EFD55803B1EA98053F1A926D322FD90EF2F21B8319F655459CABAA827DB379B7B7D59A1866D78AE919E23E21399432891C857BF4DF5946E8070107586EC4DBDC1190564293B</code></pre>
<!-- end auth_key --> <!-- 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> <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> <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 --> <!-- start dh_gen_ok -->
<p>Received payload (excluding transport headers/trailers):</p> <p>Received payload (excluding transport headers/trailers):</p>
<pre><code>0000 | 00 00 00 00 00 00 00 00 01 64 DF 98 46 49 A1 66 <pre><code>0000 | 00 00 00 00 00 00 00 00 01 B0 01 1E 6F 4C A1 66
0010 | 6C 00 00 00 34 F7 CB 3B C3 FA 31 68 7F B1 4A FE 0010 | 90 00 00 00 34 F7 CB 3B 63 87 AF ED 66 02 EE C4
0020 | 6E BB 7B F5 D8 7B 57 4C 93 54 8E 81 C9 C9 93 7B 0020 | BE 34 FF AB CB 78 31 46 91 81 A5 0F 01 24 0C A8
0030 | EF 21 FB BF 00 90 7E FF AD 66 69 D7 7F 9C D3 AE 0030 | 58 79 08 6C 85 0C 6C 58 7F 1F 84 10 80 7A 10 EB
0040 | FE 6D C0 37 21 4B 62 81</code></pre> 0040 | 7C 48 40 9D A8 D9 F1 03</code></pre>
<p>Payload (de)serialization:</p> <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> <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"> <table class="table">
@ -817,13 +817,13 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr> <tr>
<td>message_id</td> <td>message_id</td>
<td>8, 8</td> <td>8, 8</td>
<td><code>0164DF984649A166</code></td> <td><code>01B0011E6F4CA166</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> <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>
<tr> <tr>
<td>message_length</td> <td>message_length</td>
<td>16, 4</td> <td>16, 4</td>
<td><code>6C000000</code> (108 in decimal)</td> <td><code>90000000</code> (144 in decimal)</td>
<td>Message body length</td> <td>Message body length</td>
</tr> </tr>
<tr> <tr>
@ -835,19 +835,19 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
<tr> <tr>
<td>nonce</td> <td>nonce</td>
<td>24, 16</td> <td>24, 16</td>
<td><code>C3FA31687FB14AFE6EBB7BF5D87B574C</code></td> <td><code>6387AFED6602EEC4BE34FFABCB783146</code></td>
<td>Value generated by client in Step 1</td> <td>Value generated by client in Step 1</td>
</tr> </tr>
<tr> <tr>
<td>server_nonce</td> <td>server_nonce</td>
<td>40, 16</td> <td>40, 16</td>
<td><code>93548E81C9C9937BEF21FBBF00907EFF</code></td> <td><code>9181A50F01240CA85879086C850C6C58</code></td>
<td>Value received from server in Step 2</td> <td>Value received from server in Step 2</td>
</tr> </tr>
<tr> <tr>
<td>new_nonce_hash1</td> <td>new_nonce_hash1</td>
<td>56, 16</td> <td>56, 16</td>
<td><code>AD6669D77F9CD3AEFE6DC037214B6281</code></td> <td><code>7F1F8410807A10EB7C48409DA8D9F103</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> <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> </tr>
</tbody> </tbody>