diff --git a/data/web/corefork.telegram.org/api/bots.html b/data/web/corefork.telegram.org/api/bots.html index d37e86cd64..698ac5277a 100644 --- a/data/web/corefork.telegram.org/api/bots.html +++ b/data/web/corefork.telegram.org/api/bots.html @@ -74,7 +74,9 @@ Methods that can be called by bots will have a Bots can use this method<

Attachment menu »

Bots can install attachment menu entries, offering conveniently accessible, versatile web apps.

Business bots »

-

Business users can connect Telegram bots that will process and answer messages on their behalf. This allows businesses to seamlessly integrate any existing tools and workflows, or add AI assistants that manage their chats.

+

Business users can connect Telegram bots that will process and answer messages on their behalf. This allows businesses to seamlessly integrate any existing tools and workflows, or add AI assistants that manage their chats.

+

Bot API dialog IDs

+

How to convert MTProto peer IDs to bot API dialog IDs and vice versa.

diff --git a/data/web/corefork.telegram.org/api/bots/ids.html b/data/web/corefork.telegram.org/api/bots/ids.html index 5efe65fbcc..4595d1da76 100644 --- a/data/web/corefork.telegram.org/api/bots/ids.html +++ b/data/web/corefork.telegram.org/api/bots/ids.html @@ -44,9 +44,10 @@
-

The id field of peers » (i.e. users, chats, channels) contain three distinct sequences of unique 64-bit IDs used to identify a specific user, chat or channel.

-

The ID sequences of users, chats and channels overlap, so it is a good idea to transform the peer IDs to bot API dialog IDs as specified below.

-

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.

+

The id field of peers » (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.

+

The ID sequences of users, chats, channels and secret chats overlap, so it is a good idea to transform the peer IDs to bot API dialog IDs as specified below.

+

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.
+Bot API dialog IDs are already used in the bot API and in the underlying tdlib library to identify peers.

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.

More specifically, a bot API dialog ID ranges from -2002147483648 to 1099511627775.

It's a good idea to transform peer IDs to bot dialog API IDs even if you do decide to use separate databases to store info about peers, 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.

@@ -69,11 +70,12 @@ $chatId = -$botApiChatId;
$botApiChannelId = -(1000000000000 + $channelId);
 $channelId = -$botApiChannelId - 1000000000000;

Secret chat IDs

-

Secret chat IDs in the MTProto API range from -2147483648 to 2147483647 (inclusive, treat the secret chat ID as a signed 32-bit integer).

+

Secret chat IDs in the MTProto API range from -2147483648 to 2147483647 (inclusive, treat the secret chat ID as a signed little-endian 32-bit integer).

To convert MTProto chat IDs to bot API chat secret chat IDs, subtract 2000000000000.

Before conversion, always validate that they fall within the range specified above (appropriately transformed for bot API secret chat dialog IDs, i.e. -2002147483648 to -1997852516353 inclusively).

$botApiSecretChatId = $secretChatId - 2000000000000;
-$secretChatId = $botApiSecretChatId + 2000000000000;
+$secretChatId = $botApiSecretChatId + 2000000000000; +

Note: while the official instance of the bot API does not support secret chats, the underlying tdlib library does support them, and uses the format mentioned above for secret chat IDs.

diff --git a/data/web/corefork.telegram.org/constructor/user.html b/data/web/corefork.telegram.org/constructor/user.html index 70243aca76..7f4ac311f8 100644 --- a/data/web/corefork.telegram.org/constructor/user.html +++ b/data/web/corefork.telegram.org/constructor/user.html @@ -156,7 +156,7 @@ premium flags.28?true -Whether this user is a Telegram Premium user
Changes to this flag should invalidate the local userFull cache for this user ID.
Changes to this flag if the self flag is set should also trigger the following calls, to refresh the respective caches:
- help.getConfig
- messages.getTopReactions if the bot flag is not set +Whether this user is a Telegram Premium user
Changes to this flag should invalidate the local userFull cache for this user ID.
Changes to this flag if the self flag is set should also trigger the following calls, to refresh the respective caches:
- The help.getConfig cache
- The messages.getTopReactions cache if the bot flag is not set attach_menu_enabled diff --git a/data/web/corefork.telegram.org/mtproto/samples-auth_key.html b/data/web/corefork.telegram.org/mtproto/samples-auth_key.html index 1b4d65cd67..afbfc2c5fc 100644 --- a/data/web/corefork.telegram.org/mtproto/samples-auth_key.html +++ b/data/web/corefork.telegram.org/mtproto/samples-auth_key.html @@ -53,9 +53,9 @@
1) Client sends query to server

Sent payload (excluding transport headers/trailers):

-
0000 | 00 00 00 00 00 00 00 00 14 6F 0E 00 45 49 A1 66
-0010 | 14 00 00 00 F1 8E 7E BE C3 FA 31 68 7F B1 4A FE
-0020 | 6E BB 7B F5 D8 7B 57 4C
+
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 63 87 AF ED 66 02 EE C4
+0020 | BE 34 FF AB CB 78 31 46

Payload (de)serialization:

req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;
@@ -77,7 +77,7 @@ - + @@ -95,7 +95,7 @@ - + @@ -104,11 +104,11 @@
2) Server sends response of the form

Received payload (excluding transport headers/trailers):

-
0000 | 00 00 00 00 00 00 00 00 01 D4 D3 1E 45 49 A1 66
-0010 | C8 00 00 00 63 24 16 05 C3 FA 31 68 7F B1 4A FE
-0020 | 6E BB 7B F5 D8 7B 57 4C 93 54 8E 81 C9 C9 93 7B
-0030 | EF 21 FB BF 00 90 7E FF 08 26 4C BF 7C 87 82 6D
-0040 | C3 00 00 00 15 C4 B5 1C 03 00 00 00 A5 B7 F7 09
+
0000 | 00 00 00 00 00 00 00 00 01 54 82 F4 6D 4C A1 66
+0010 | BC 00 00 00 63 24 16 05 63 87 AF ED 66 02 EE C4
+0020 | BE 34 FF AB CB 78 31 46 91 81 A5 0F 01 24 0C A8
+0030 | 58 79 08 6C 85 0C 6C 58 08 1F 93 90 C2 6C D9 D8
+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
 0060 | 85 1D 9D D0

Payload (de)serialization:

@@ -132,13 +132,13 @@
- + - + @@ -150,19 +150,19 @@ - + - + - + @@ -208,22 +208,22 @@

Proof of work

3) Client decomposes pq into prime factors such that p < q.
-
pq = 2759791213241593283
-

Decompose into 2 prime cofactors p < q: 2759791213241593283 = 1506452021 * 1831980823

-
p = 1506452021
-q = 1831980823
+
pq = 2275321401476503781
+

Decompose into 2 prime cofactors p < q: 2275321401476503781 = 1239149183 * 1836196507

+
p = 1239149183
+q = 1836196507

Presenting proof of work; Server authentication

4) encrypted_data payload generation

First of all, generate an encrypted_data payload as follows:

Generated payload (excluding transport headers/trailers):

-
0000 | 95 5F F5 A9 08 26 4C BF 7C 87 82 6D C3 00 00 00
-0010 | 04 59 CA A2 35 00 00 00 04 6D 31 CF 17 00 00 00
-0020 | C3 FA 31 68 7F B1 4A FE 6E BB 7B F5 D8 7B 57 4C
-0030 | 93 54 8E 81 C9 C9 93 7B EF 21 FB BF 00 90 7E FF
-0040 | 8E 82 B2 E5 69 2C 07 17 41 E1 46 76 3E CD 3E DB
-0050 | 60 1C B7 6C 66 70 C6 99 46 11 C8 5E 20 42 1F 99
+
0000 | 95 5F F5 A9 08 1F 93 90 C2 6C D9 D8 E5 00 00 00
+0010 | 04 49 DB EA 7F 00 00 00 04 6D 72 22 9B 00 00 00
+0020 | 63 87 AF ED 66 02 EE C4 BE 34 FF AB CB 78 31 46
+0030 | 91 81 A5 0F 01 24 0C A8 58 79 08 6C 85 0C 6C 58
+0040 | 5E 49 3C EC F0 53 CD 5D B9 A4 CF CF 43 9E 30 1B
+0050 | 7D D6 65 88 10 55 C1 AB 0D 63 D0 A9 7E 76 57 63
 0060 | 02 00 00 00

Payload (de)serialization:

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;
@@ -246,37 +246,37 @@ q = 1831980823
- + - + - + - + - + - + @@ -291,39 +291,39 @@ q = 1831980823

The serialization of P_Q_inner_data produces data, which is used to generate encrypted_data as specified in step 4.1.
These are the inputs to the algorithm specified in step 4.1:

-
data = 955FF5A908264CBF7C87826DC30000000459CAA235000000046D31CF17000000C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EFF8E82B2E5692C071741E146763ECD3EDB601CB76C6670C6994611C85E20421F9902000000
-random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915F9CB47068A3C6872388CAF63EFFE9FA7676AE2D87D05E5F0A5BC3467935B59F24414D219C5436AC0F3BEC1F512233FACB9623FB6A73074692E31A0672923F65
+
data = 955FF5A9081F9390C26CD9D8E50000000449DBEA7F000000046D72229B0000006387AFED6602EEC4BE34FFABCB7831469181A50F01240CA85879086C850C6C585E493CECF053CD5DB9A4CFCF439E301B7DD665881055C1AB0D63D0A97E76576302000000
+random_padding_bytes = 0698269139B02028B47DE71A40CD62C1A289DADF0EAD34F3C433FD23A0620195304EB11ACC6A85FAFC827A9E91280C61523CDF0FF3AC654E2F06FD60D2FFEB4D921ABF6131D3B8C652ABAAEFDF1F3FCEC5FA060C99B13498891F0F89

And this is the output:

-
encrypted_data = 060322C172A83BC12CFE35E07606AB8D66671FEF502655CD9F0710056C1F0D1ECC01C45243FFF3609A97B1335687D4E82DB680B9A4C71B3FC0E0CDF2F1680B604AFE0BDE34A8D43CD1A52D4D7144FF87482141F4B96B390216483DBF7D393F502ED148BB030D463B52464E6689E280CF602DC7A5370AD9AC4407EEA650FA631431B32B92381226A17122CFD063C7B687D3A5BBAA120E234B891824D720381E743297EEF9FE34D28DE82F506AD2FED78404AB7A27C6DF81ADCDB797C3EEA331C6883700DAC0E466B77DF36812F14A37F95A617C96C9C319AEED1D68DA2303EAFB4EFAA2BD36517BC044F10C5C2C8ECF5A2917FDFF06EBE9C4A4BE412D321AEDC1
+
encrypted_data = 8731291CDD5513220A82626E9BE5FFBE1F760F72AA6D277BE83F2132B0734E46B518AADF0AC8E2348E1CCC3474C7F6F72C4874B2313DCF8F5E40C978B3317DB30872B428DE70FA6317DA068B31C428414AD03B8ACE80D222A48EA4AEA93D1AAB7B98B36820D68723F2110BEBEFA56EEEE1989226A902E2D0A7116D1F90E1CDBBE735C85948FD12AA010E94A6B8CA76B641EDA7D81571260D9B68D1C8DD23D3875255DFEC41C90B7FD00D08FDF4C1FF4EB91063D51790FE3F3B96E6FE9476D076A1ECB55E7ED1B9221353B9EADDBDB1E71CBDE9E08B1211355CBEFD12D6350361515CBCF4991A280A40AD95A5F6F73DC24658580FFD89F29B65D5FDC0677F333E

The length of the final string is 256 bytes.

5) Send req_DH_params query with generated encrypted_data

Sent payload (excluding transport headers/trailers):

-
0000 | 00 00 00 00 00 00 00 00 18 6F 0E 00 45 49 A1 66
-0010 | 40 01 00 00 BE E4 12 D7 C3 FA 31 68 7F B1 4A FE
-0020 | 6E BB 7B F5 D8 7B 57 4C 93 54 8E 81 C9 C9 93 7B
-0030 | EF 21 FB BF 00 90 7E FF 04 59 CA A2 35 00 00 00
-0040 | 04 6D 31 CF 17 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
-0060 | 76 06 AB 8D 66 67 1F EF 50 26 55 CD 9F 07 10 05
-0070 | 6C 1F 0D 1E CC 01 C4 52 43 FF F3 60 9A 97 B1 33
-0080 | 56 87 D4 E8 2D B6 80 B9 A4 C7 1B 3F C0 E0 CD F2
-0090 | F1 68 0B 60 4A FE 0B DE 34 A8 D4 3C D1 A5 2D 4D
-00A0 | 71 44 FF 87 48 21 41 F4 B9 6B 39 02 16 48 3D BF
-00B0 | 7D 39 3F 50 2E D1 48 BB 03 0D 46 3B 52 46 4E 66
-00C0 | 89 E2 80 CF 60 2D C7 A5 37 0A D9 AC 44 07 EE A6
-00D0 | 50 FA 63 14 31 B3 2B 92 38 12 26 A1 71 22 CF D0
-00E0 | 63 C7 B6 87 D3 A5 BB AA 12 0E 23 4B 89 18 24 D7
-00F0 | 20 38 1E 74 32 97 EE F9 FE 34 D2 8D E8 2F 50 6A
-0100 | D2 FE D7 84 04 AB 7A 27 C6 DF 81 AD CD B7 97 C3
-0110 | EE A3 31 C6 88 37 00 DA C0 E4 66 B7 7D F3 68 12
-0120 | F1 4A 37 F9 5A 61 7C 96 C9 C3 19 AE ED 1D 68 DA
-0130 | 23 03 EA FB 4E FA A2 BD 36 51 7B C0 44 F1 0C 5C
-0140 | 2C 8E CF 5A 29 17 FD FF 06 EB E9 C4 A4 BE 41 2D
-0150 | 32 1A ED C1
+
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 63 87 AF ED 66 02 EE C4
+0020 | BE 34 FF AB CB 78 31 46 91 81 A5 0F 01 24 0C A8
+0030 | 58 79 08 6C 85 0C 6C 58 04 49 DB EA 7F 00 00 00
+0040 | 04 6D 72 22 9B 00 00 00 85 FD 64 DE 85 1D 9D D0
+0050 | FE 00 01 00 87 31 29 1C DD 55 13 22 0A 82 62 6E
+0060 | 9B E5 FF BE 1F 76 0F 72 AA 6D 27 7B E8 3F 21 32
+0070 | B0 73 4E 46 B5 18 AA DF 0A C8 E2 34 8E 1C CC 34
+0080 | 74 C7 F6 F7 2C 48 74 B2 31 3D CF 8F 5E 40 C9 78
+0090 | B3 31 7D B3 08 72 B4 28 DE 70 FA 63 17 DA 06 8B
+00A0 | 31 C4 28 41 4A D0 3B 8A CE 80 D2 22 A4 8E A4 AE
+00B0 | A9 3D 1A AB 7B 98 B3 68 20 D6 87 23 F2 11 0B EB
+00C0 | EF A5 6E EE E1 98 92 26 A9 02 E2 D0 A7 11 6D 1F
+00D0 | 90 E1 CD BB E7 35 C8 59 48 FD 12 AA 01 0E 94 A6
+00E0 | B8 CA 76 B6 41 ED A7 D8 15 71 26 0D 9B 68 D1 C8
+00F0 | DD 23 D3 87 52 55 DF EC 41 C9 0B 7F D0 0D 08 FD
+0100 | F4 C1 FF 4E B9 10 63 D5 17 90 FE 3F 3B 96 E6 FE
+0110 | 94 76 D0 76 A1 EC B5 5E 7E D1 B9 22 13 53 B9 EA
+0120 | DD BD B1 E7 1C BD E9 E0 8B 12 11 35 5C BE FD 12
+0130 | D6 35 03 61 51 5C BC F4 99 1A 28 0A 40 AD 95 A5
+0140 | F6 F7 3D C2 46 58 58 0F FD 89 F2 9B 65 D5 FD C0
+0150 | 67 7F 33 3E

Payload (de)serialization:

req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:string q:string public_key_fingerprint:long encrypted_data:string = Server_DH_Params;
message_id 8, 8146F0E004549A1661CDF07006D4CA166 Message ID generated as specified here » (unixtime() << 32) + (N*4)
nonce 24, 16C3FA31687FB14AFE6EBB7BF5D87B574C6387AFED6602EEC4BE34FFABCB783146 Random number
message_id 8, 801D4D31E4549A166015482F46D4CA166 Message ID generated as specified here » (unixtime() << 32) + (N*4)
message_length 16, 4C8000000 (200 in decimal)BC000000 (188 in decimal) Message body length
nonce 24, 16C3FA31687FB14AFE6EBB7BF5D87B574C6387AFED6602EEC4BE34FFABCB783146 Value generated by client in Step 1
server_nonce 40, 1693548E81C9C9937BEF21FBBF00907EFF9181A50F01240CA85879086C850C6C58 Server-generated random number
pq 56, 1208264CBF7C87826DC3000000
TL byte deserialization
=> bigendian conversion to decimal
=> 2759791213241593283
081F9390C26CD9D8E5000000
TL byte deserialization
=> bigendian conversion to decimal
=> 2275321401476503781
Single-byte prefix denoting length, an 8-byte string, and three bytes of padding
pq 4, 1208264CBF7C87826DC3000000
TL byte deserialization
=> bigendian conversion to decimal
=> 2759791213241593283
081F9390C26CD9D8E5000000
TL byte deserialization
=> bigendian conversion to decimal
=> 2275321401476503781
Single-byte prefix denoting length, 8-byte string, and three bytes of padding
p 16, 80459CAA235000000
TL byte deserialization
=> bigendian conversion to decimal
=> 1506452021
0449DBEA7F000000
TL byte deserialization
=> bigendian conversion to decimal
=> 1239149183
First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding
q 24, 8046D31CF17000000
TL byte deserialization
=> bigendian conversion to decimal
=> 1831980823
046D72229B000000
TL byte deserialization
=> bigendian conversion to decimal
=> 1836196507
Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding
nonce 32, 16C3FA31687FB14AFE6EBB7BF5D87B574C6387AFED6602EEC4BE34FFABCB783146 Value generated by client in Step 1
server_nonce 48, 1693548E81C9C9937BEF21FBBF00907EFF9181A50F01240CA85879086C850C6C58 Value received from server in Step 2
new_nonce 64, 328E82B2E5692C071741E146763ECD3EDB 601CB76C6670C6994611C85E20421F995E493CECF053CD5DB9A4CFCF439E301B 7DD665881055C1AB0D63D0A97E765763 Client-generated random number
@@ -345,7 +345,7 @@ random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915 - + @@ -363,25 +363,25 @@ random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915 - + - + - + - + @@ -393,7 +393,7 @@ random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915 - + @@ -402,47 +402,47 @@ random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915
6) Server responds with:

Received payload (excluding transport headers/trailers):

-
0000 | 00 00 00 00 00 00 00 00 01 F4 47 F4 45 49 A1 66
-0010 | C0 02 00 00 5C 07 E8 D0 C3 FA 31 68 7F B1 4A FE
-0020 | 6E BB 7B F5 D8 7B 57 4C 93 54 8E 81 C9 C9 93 7B
-0030 | EF 21 FB BF 00 90 7E FF FE 50 02 00 6A 39 36 56
-0040 | 63 7B 0E 06 03 AF 89 0D A2 16 7E 32 E3 ED 23 8B
-0050 | 94 56 8C AB 84 8C 88 89 62 43 98 C3 71 35 7C A7
-0060 | F7 8B 33 67 90 C7 3C BB FB 49 0D C2 38 0C 7A F4
-0070 | 9E 6D E4 0D D6 2A 24 AF 73 0F 13 9B 71 F8 FF D9
-0080 | 73 43 06 59 76 83 86 AE 23 05 46 96 D4 FD E3 E5
-0090 | 9D 9D 7D 89 A0 0A 6C 25 FF B3 F5 BF CE 9B 0D 7C
-00A0 | 4C F1 36 48 86 91 F9 48 0C B4 9B FA 85 DF 22 6E
-00B0 | CE 7D 31 27 88 55 A7 B5 24 E4 25 6C 08 AE 14 2B
-00C0 | 14 43 42 63 3F 4B 27 A8 78 A0 7E 78 08 CF E6 57
-00D0 | 18 73 7F 75 21 B4 0D BF 7B 6B 43 C8 50 4B 96 8C
-00E0 | F1 7A F4 3C F9 85 71 E2 DA 71 82 D3 09 6F 68 3F
-00F0 | BC 23 0E D7 55 FA 0C 35 8F E5 13 77 08 CF CD DE
-0100 | F4 0B FA 49 56 1E CE 35 32 F9 13 54 90 D9 B0 8E
-0110 | 33 9E FE D4 63 89 D8 54 4B 99 C5 73 60 72 96 83
-0120 | 0A EB B6 FC F8 E0 38 75 A9 10 AE 1D 7F 86 5A A1
-0130 | 34 9A F5 4D 3C 43 9A 8E 2E 65 39 71 53 02 BD 2F
-0140 | 1E 3E 7F 72 E9 71 17 24 DE B9 69 FA D6 7F 12 C7
-0150 | 7C AC C1 31 D0 F9 79 31 38 CA DA B8 AA 37 8C DD
-0160 | 30 8C D5 F8 16 77 F4 61 69 B1 33 9F A8 2B 0B 22
-0170 | 6E 1E 0A F6 8F E7 83 66 97 F6 D0 4A E7 41 A8 BE
-0180 | C2 93 EE E7 13 DA D1 90 4E A3 AE D9 96 D2 B7 45
-0190 | 51 0C B5 1B 4E 9F 4B 28 39 8E 18 9A AF E7 DC 04
-01A0 | 61 C7 EC 37 50 17 88 69 41 DA 19 A4 46 CD 45 0C
-01B0 | 9A 10 70 F3 4C 5F E7 58 94 A9 55 54 13 26 88 1B
-01C0 | C0 60 9E B2 2D 83 E3 26 CE 0F 42 ED 0C 4E 25 E9
-01D0 | 4D 57 6A 51 43 A8 49 92 57 E2 7F 27 04 C1 CF 2E
-01E0 | 43 F7 72 35 31 DF F0 90 26 A3 94 3D F1 C8 72 F2
-01F0 | 58 4B 4E 50 F0 F8 2F 70 6E 9C CE B5 43 F5 80 7C
-0200 | 60 90 F5 9A 5C 17 11 AD 4D 15 F4 2B 35 5E 4D B2
-0210 | 91 21 64 08 97 C0 E5 BA C1 6A C7 D7 B2 92 FF 4B
-0220 | 0B 39 32 9F 75 A5 2F 12 6F 47 8D DB 61 07 3B 85
-0230 | AD 16 35 6C E6 2C C6 EE EC 25 B6 B2 DA E3 6D 36
-0240 | 9E 14 F2 55 B6 86 A5 A6 5C 89 B9 24 0F D4 80 AA
-0250 | A3 09 64 3E D8 78 73 F1 B8 C7 6C 4D EA D3 2B 9B
-0260 | 7D B2 EB 19 75 E3 22 B4 0B 13 35 D3 36 A2 A6 1D
-0270 | AF BD FC 5D 08 97 D2 FD 53 2E 31 29 99 1E C3 B5
-0280 | 67 2E 75 EF 49 74 62 00 36 7F 59 E6
+
0000 | 00 00 00 00 00 00 00 00 01 34 21 96 6E 4C A1 66
+0010 | 78 02 00 00 5C 07 E8 D0 63 87 AF ED 66 02 EE C4
+0020 | BE 34 FF AB CB 78 31 46 91 81 A5 0F 01 24 0C A8
+0030 | 58 79 08 6C 85 0C 6C 58 FE 50 02 00 24 D0 29 7F
+0040 | B1 57 8E B5 7D 1B B0 90 DE 7D DB B0 84 CE B3 3A
+0050 | 48 CA 1A 7C D1 BD 38 AD B0 E7 CE 35 DE 20 7C 03
+0060 | 85 51 82 7B B7 A3 8A F8 53 88 AA A9 B6 4C 8A 7F
+0070 | 28 E6 A0 B7 4A FE BD EB 11 91 1A 19 C7 7F 68 55
+0080 | 1F B0 BB 18 C2 B6 04 2E A0 44 3D 17 C7 59 A0 0F
+0090 | 88 E1 B9 19 D5 F6 13 61 72 75 C4 F7 14 B7 E3 E4
+00A0 | 2C 13 46 CF 37 CF B7 E4 05 DC 83 52 21 DC 3B 8D
+00B0 | B4 FE CE 96 06 3C 5E B4 95 ED 1B 1D A2 A4 80 F4
+00C0 | A1 F2 7C 28 5E 81 76 C4 18 8A 28 3A 0F 0B EE F9
+00D0 | 09 3A 05 8F 3F 69 09 1C 39 E6 66 F0 97 BD 0B B2
+00E0 | AE 47 BC 46 CC EB 1B 95 6C 51 00 18 F6 27 D6 2C
+00F0 | 70 D2 B7 2B AC 7B 0B DC CE 18 7C 32 6D 66 45 8E
+0100 | E2 2E 63 15 9B E2 C1 A2 F7 75 63 D7 C3 F2 0F E8
+0110 | 88 FA FB B6 7B CB 18 BB AD 5B 49 18 48 D5 3B A9
+0120 | D8 4C D4 B8 31 F6 7F 44 7B DC 68 6C 9E B7 EE 7B
+0130 | 17 C9 C0 0D 42 6F C4 FB 12 7C D1 4D B4 2B F7 EA
+0140 | 05 2E D1 5D 9D 5E DF 2F C0 6A F1 75 B3 28 E6 A5
+0150 | 3A A6 B5 32 07 80 74 6C 7C 81 1A 50 23 5D E7 E3
+0160 | 5D 08 E4 4D 52 2C 4A 17 63 B6 84 89 BD A3 6F B7
+0170 | F6 0B FE 17 43 02 DC 72 50 DC 0F 0C 9A 8A 2A A9
+0180 | 65 2B DE 11 56 92 08 B8 24 53 9A 95 4C 12 EE 41
+0190 | C0 89 2D 80 E4 43 E2 0B E2 4A B3 65 76 F6 8C 67
+01A0 | CC 90 36 0E 85 FC C1 92 55 2D C4 23 F6 BA 11 65
+01B0 | F2 23 78 F8 B3 92 91 5F 89 1E DC 57 C1 5B 64 AC
+01C0 | 0B EF 3F 4E 07 5F 9C 4B EE FB 9A 4E F3 0E EB 4A
+01D0 | 82 03 EE 60 51 10 9D 97 DE F1 47 B7 6C 42 AA B3
+01E0 | C7 27 46 C4 D7 0E 26 48 AC 79 35 B7 21 AD 64 00
+01F0 | 9E C5 A5 19 DF 85 BA ED 49 0E EB CA C0 69 82 1D
+0200 | 71 0F D1 65 7D D7 29 FC 5B 77 69 B8 7D 3E 90 17
+0210 | C9 0F 34 EF C1 39 3C A1 B1 E4 AC 2E FE 2D 53 E1
+0220 | 58 E7 7A 8F ED 95 2B 66 27 81 B3 19 2F 44 47 EB
+0230 | 44 C4 A8 C8 CA EC DA 02 63 FF 74 59 61 2D 53 0D
+0240 | 4B F5 33 22 B4 4E 92 E0 2E A5 E8 4C C2 2B D7 C0
+0250 | 16 C8 1D F2 FA 98 DE BE B7 3D 5D 8A C8 D3 6D 03
+0260 | 42 60 78 52 76 C2 61 69 A2 19 7A 74 07 C4 D3 53
+0270 | 27 EF 77 67 C5 C8 56 02 A2 09 34 12 15 D1 6D 00
+0280 | 78 6C E8 30 66 CF E3 B6 21 52 6E EF

Payload (de)serialization:

server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;
message_id 8, 8186F0E004549A166F0280E006E4CA166 Message ID generated as specified here » (unixtime() << 32) + (N*4)
nonce 24, 16C3FA31687FB14AFE6EBB7BF5D87B574C6387AFED6602EEC4BE34FFABCB783146 Value generated by client in Step 1
server_nonce 40, 1693548E81C9C9937BEF21FBBF00907EFF9181A50F01240CA85879086C850C6C58 Value received from server in Step 2
p 56, 80459CAA235000000
TL byte deserialization
=> bigendian conversion to decimal
=> 1506452021
0449DBEA7F000000
TL byte deserialization
=> bigendian conversion to decimal
=> 1239149183
First prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding
q 64, 8046D31CF17000000
TL byte deserialization
=> bigendian conversion to decimal
=> 1831980823
046D72229B000000
TL byte deserialization
=> bigendian conversion to decimal
=> 1836196507
Second prime cofactor: single-byte prefix denoting length, 4-byte string, and three bytes of padding
encrypted_data 80, 260FE000100060322C172A83BC12CFE35E0 7606AB8D66671FEF502655CD9F071005 6C1F0D1ECC01C45243FFF3609A97B133 5687D4E82DB680B9A4C71B3FC0E0CDF2 F1680B604AFE0BDE34A8D43CD1A52D4D 7144FF87482141F4B96B390216483DBF 7D393F502ED148BB030D463B52464E66 89E280CF602DC7A5370AD9AC4407EEA6 50FA631431B32B92381226A17122CFD0 63C7B687D3A5BBAA120E234B891824D7 20381E743297EEF9FE34D28DE82F506A D2FED78404AB7A27C6DF81ADCDB797C3 EEA331C6883700DAC0E466B77DF36812 F14A37F95A617C96C9C319AEED1D68DA 2303EAFB4EFAA2BD36517BC044F10C5C 2C8ECF5A2917FDFF06EBE9C4A4BE412D
321AEDC1
FE0001008731291CDD5513220A82626E 9BE5FFBE1F760F72AA6D277BE83F2132 B0734E46B518AADF0AC8E2348E1CCC34 74C7F6F72C4874B2313DCF8F5E40C978 B3317DB30872B428DE70FA6317DA068B 31C428414AD03B8ACE80D222A48EA4AE A93D1AAB7B98B36820D68723F2110BEB EFA56EEEE1989226A902E2D0A7116D1F 90E1CDBBE735C85948FD12AA010E94A6 B8CA76B641EDA7D81571260D9B68D1C8 DD23D3875255DFEC41C90B7FD00D08FD F4C1FF4EB91063D51790FE3F3B96E6FE 9476D076A1ECB55E7ED1B9221353B9EA DDBDB1E71CBDE9E08B1211355CBEFD12 D6350361515CBCF4991A280A40AD95A5 F6F73DC24658580FFD89F29B65D5FDC0
677F333E
Value generated above
@@ -464,13 +464,13 @@ random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915 - + - + @@ -482,19 +482,19 @@ random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915 - + - + - + @@ -502,20 +502,20 @@ random_padding_bytes = 78E32DC9E72D69A37891B7DAB6CA96125DE295DEB4DC017B6D726D915

Decrypt encrypted_answer using the reverse of the process specified in step 6:

-
encrypted_answer = 6A393656637B0E0603AF890DA2167E32E3ED238B94568CAB848C8889624398C371357CA7F78B336790C73CBBFB490DC2380C7AF49E6DE40DD62A24AF730F139B71F8FFD973430659768386AE23054696D4FDE3E59D9D7D89A00A6C25FFB3F5BFCE9B0D7C4CF136488691F9480CB49BFA85DF226ECE7D31278855A7B524E4256C08AE142B144342633F4B27A878A07E7808CFE65718737F7521B40DBF7B6B43C8504B968CF17AF43CF98571E2DA7182D3096F683FBC230ED755FA0C358FE5137708CFCDDEF40BFA49561ECE3532F9135490D9B08E339EFED46389D8544B99C573607296830AEBB6FCF8E03875A910AE1D7F865AA1349AF54D3C439A8E2E6539715302BD2F1E3E7F72E9711724DEB969FAD67F12C77CACC131D0F9793138CADAB8AA378CDD308CD5F81677F46169B1339FA82B0B226E1E0AF68FE7836697F6D04AE741A8BEC293EEE713DAD1904EA3AED996D2B745510CB51B4E9F4B28398E189AAFE7DC0461C7EC375017886941DA19A446CD450C9A1070F34C5FE75894A955541326881BC0609EB22D83E326CE0F42ED0C4E25E94D576A5143A8499257E27F2704C1CF2E43F7723531DFF09026A3943DF1C872F2584B4E50F0F82F706E9CCEB543F5807C6090F59A5C1711AD4D15F42B355E4DB29121640897C0E5BAC16AC7D7B292FF4B0B39329F75A52F126F478DDB61073B85AD16356CE62CC6EEEC25B6B2DAE36D369E14F255B686A5A65C89B9240FD480AAA309643ED87873F1B8C76C4DEAD32B9B7DB2EB1975E322B40B1335D336A2A61DAFBDFC5D0897D2FD532E3129991EC3B5672E75EF49746200367F59E6
-tmp_aes_key = 12E80C711D4E145929DBD59D74C4C9C784B465D36C86484EDB794E373343523A
-tmp_aes_iv = E46740B6386AD583BC7C143BDF4332C678F9CDC8EAB6EB4E602EBEF48E82B2E5
+
encrypted_answer = 24D0297FB1578EB57D1BB090DE7DDBB084CEB33A48CA1A7CD1BD38ADB0E7CE35DE207C038551827BB7A38AF85388AAA9B64C8A7F28E6A0B74AFEBDEB11911A19C77F68551FB0BB18C2B6042EA0443D17C759A00F88E1B919D5F613617275C4F714B7E3E42C1346CF37CFB7E405DC835221DC3B8DB4FECE96063C5EB495ED1B1DA2A480F4A1F27C285E8176C4188A283A0F0BEEF9093A058F3F69091C39E666F097BD0BB2AE47BC46CCEB1B956C510018F627D62C70D2B72BAC7B0BDCCE187C326D66458EE22E63159BE2C1A2F77563D7C3F20FE888FAFBB67BCB18BBAD5B491848D53BA9D84CD4B831F67F447BDC686C9EB7EE7B17C9C00D426FC4FB127CD14DB42BF7EA052ED15D9D5EDF2FC06AF175B328E6A53AA6B5320780746C7C811A50235DE7E35D08E44D522C4A1763B68489BDA36FB7F60BFE174302DC7250DC0F0C9A8A2AA9652BDE11569208B824539A954C12EE41C0892D80E443E20BE24AB36576F68C67CC90360E85FCC192552DC423F6BA1165F22378F8B392915F891EDC57C15B64AC0BEF3F4E075F9C4BEEFB9A4EF30EEB4A8203EE6051109D97DEF147B76C42AAB3C72746C4D70E2648AC7935B721AD64009EC5A519DF85BAED490EEBCAC069821D710FD1657DD729FC5B7769B87D3E9017C90F34EFC1393CA1B1E4AC2EFE2D53E158E77A8FED952B662781B3192F4447EB44C4A8C8CAECDA0263FF7459612D530D4BF53322B44E92E02EA5E84CC22BD7C016C81DF2FA98DEBEB73D5D8AC8D36D034260785276C26169A2197A7407C4D35327EF7767C5C85602A209341215D16D00786CE83066CFE3B621526EEF
+tmp_aes_key = 87A16D7D6F2AED65D4FDB26C6F77466043B2F2DB09F5CB131C091193BA7493A5
+tmp_aes_iv = 2EF58137AFB5123EADA871026C9DEB69207A69AD90ADC7FACA1570495E493CEC

Yielding:

-
answer_with_hash = B3A14A01ED2A48826CB1A652B10DBF0B160345D3BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EFF03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE0001006F7B20B65478004B0FFAFBE7C96EA5EB35B8CED549CDF7C2B950F7E4B813DCF2F1E0566D7E2AB00D5F3AADE543648D2BE878EE9CBEB8ADA694580644339F1CC73FC96DB2028328EFB62AA8D9AFC68F7C58373382813B5C39228E3F1AF42B0150C9FA09F7CA96332360B7B021CF3B6C6F22B9F881593997C5EB9315F3504119A983A93BC2CBEB48EDAADEE189C2E2E1370A5E01172854E7B700A81E4DB92BF0BF8B836988C27502237F862B65C6E98C1A095E9699096347551F949284611DCBDC29428044AA7D31A09E4E25E1D4A064146085721B64E010AD51DAC6E5DFFAAC4E478636E596C044C50EF6495F2AFB70AA802884757F3F5DDA30CCF3AA4AD65CBE4549A166843F091D09114CAA
-answer = BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EFF03000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE0001006F7B20B65478004B0FFAFBE7C96EA5EB35B8CED549CDF7C2B950F7E4B813DCF2F1E0566D7E2AB00D5F3AADE543648D2BE878EE9CBEB8ADA694580644339F1CC73FC96DB2028328EFB62AA8D9AFC68F7C58373382813B5C39228E3F1AF42B0150C9FA09F7CA96332360B7B021CF3B6C6F22B9F881593997C5EB9315F3504119A983A93BC2CBEB48EDAADEE189C2E2E1370A5E01172854E7B700A81E4DB92BF0BF8B836988C27502237F862B65C6E98C1A095E9699096347551F949284611DCBDC29428044AA7D31A09E4E25E1D4A064146085721B64E010AD51DAC6E5DFFAAC4E478636E596C044C50EF6495F2AFB70AA802884757F3F5DDA30CCF3AA4AD65CBE4549A166843F091D09114CAA
+
answer_with_hash = AC0276C7739EEDE2111877BDA636E63A646074A1BA0D89B56387AFED6602EEC4BE34FFABCB7831469181A50F01240CA85879086C850C6C5803000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE00010061A54F355453D62BA850E1DEB2B9577E0ADFA00EF2B6A78426054AA8860885A2169064A4596EBF4CC332B564EC7594E841A8658355698A403EEF98C3D777919475A8311E62ECA435DBEC740F8BB8677C6A7650542872F24967352E83EEB889A44588DE6C8B380F7F69617EEE1C11344E3CB123DD27550D752E87567DED6E1CFE21ED4D517855E71E08BE0FC5144837BADB8CD899CA09E16C778CC9BDD7FC548D316F56EC204601F70E7C0103978014067D4BA5271C1D261CCCFA79CF5F6D6B47D768AABD844BB343A25341AD29BD9E705B1BB8EEDFEAE6AC6C775DB2B3324C4E02A84EFC1080DDB22B568C58FF05E633DD7D868EADC5DE69E44184964E260E146E4CA166B99604E76897DCB2
+answer = BA0D89B56387AFED6602EEC4BE34FFABCB7831469181A50F01240CA85879086C850C6C5803000000FE000100C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5BFE00010061A54F355453D62BA850E1DEB2B9577E0ADFA00EF2B6A78426054AA8860885A2169064A4596EBF4CC332B564EC7594E841A8658355698A403EEF98C3D777919475A8311E62ECA435DBEC740F8BB8677C6A7650542872F24967352E83EEB889A44588DE6C8B380F7F69617EEE1C11344E3CB123DD27550D752E87567DED6E1CFE21ED4D517855E71E08BE0FC5144837BADB8CD899CA09E16C778CC9BDD7FC548D316F56EC204601F70E7C0103978014067D4BA5271C1D261CCCFA79CF5F6D6B47D768AABD844BB343A25341AD29BD9E705B1BB8EEDFEAE6AC6C775DB2B3324C4E02A84EFC1080DDB22B568C58FF05E633DD7D868EADC5DE69E44184964E260E146E4CA166B99604E76897DCB2

Generated payload (excluding transport headers/trailers):

-
0000 | BA 0D 89 B5 C3 FA 31 68 7F B1 4A FE 6E BB 7B F5
-0010 | D8 7B 57 4C 93 54 8E 81 C9 C9 93 7B EF 21 FB BF
-0020 | 00 90 7E FF 03 00 00 00 FE 00 01 00 C7 1C AE B9
+
0000 | BA 0D 89 B5 63 87 AF ED 66 02 EE C4 BE 34 FF AB
+0010 | CB 78 31 46 91 81 A5 0F 01 24 0C A8 58 79 08 6C
+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
 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 = BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EF
 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 | 6F 7B 20 B6 54 78 00 4B 0F FA FB E7 C9 6E A5 EB
-0140 | 35 B8 CE D5 49 CD F7 C2 B9 50 F7 E4 B8 13 DC F2
-0150 | F1 E0 56 6D 7E 2A B0 0D 5F 3A AD E5 43 64 8D 2B
-0160 | E8 78 EE 9C BE B8 AD A6 94 58 06 44 33 9F 1C C7
-0170 | 3F C9 6D B2 02 83 28 EF B6 2A A8 D9 AF C6 8F 7C
-0180 | 58 37 33 82 81 3B 5C 39 22 8E 3F 1A F4 2B 01 50
-0190 | C9 FA 09 F7 CA 96 33 23 60 B7 B0 21 CF 3B 6C 6F
-01A0 | 22 B9 F8 81 59 39 97 C5 EB 93 15 F3 50 41 19 A9
-01B0 | 83 A9 3B C2 CB EB 48 ED AA DE E1 89 C2 E2 E1 37
-01C0 | 0A 5E 01 17 28 54 E7 B7 00 A8 1E 4D B9 2B F0 BF
-01D0 | 8B 83 69 88 C2 75 02 23 7F 86 2B 65 C6 E9 8C 1A
-01E0 | 09 5E 96 99 09 63 47 55 1F 94 92 84 61 1D CB DC
-01F0 | 29 42 80 44 AA 7D 31 A0 9E 4E 25 E1 D4 A0 64 14
-0200 | 60 85 72 1B 64 E0 10 AD 51 DA C6 E5 DF FA AC 4E
-0210 | 47 86 36 E5 96 C0 44 C5 0E F6 49 5F 2A FB 70 AA
-0220 | 80 28 84 75 7F 3F 5D DA 30 CC F3 AA 4A D6 5C BE
-0230 | 45 49 A1 66
+0130 | 61 A5 4F 35 54 53 D6 2B A8 50 E1 DE B2 B9 57 7E +0140 | 0A DF A0 0E F2 B6 A7 84 26 05 4A A8 86 08 85 A2 +0150 | 16 90 64 A4 59 6E BF 4C C3 32 B5 64 EC 75 94 E8 +0160 | 41 A8 65 83 55 69 8A 40 3E EF 98 C3 D7 77 91 94 +0170 | 75 A8 31 1E 62 EC A4 35 DB EC 74 0F 8B B8 67 7C +0180 | 6A 76 50 54 28 72 F2 49 67 35 2E 83 EE B8 89 A4 +0190 | 45 88 DE 6C 8B 38 0F 7F 69 61 7E EE 1C 11 34 4E +01A0 | 3C B1 23 DD 27 55 0D 75 2E 87 56 7D ED 6E 1C FE +01B0 | 21 ED 4D 51 78 55 E7 1E 08 BE 0F C5 14 48 37 BA +01C0 | DB 8C D8 99 CA 09 E1 6C 77 8C C9 BD D7 FC 54 8D +01D0 | 31 6F 56 EC 20 46 01 F7 0E 7C 01 03 97 80 14 06 +01E0 | 7D 4B A5 27 1C 1D 26 1C CC FA 79 CF 5F 6D 6B 47 +01F0 | D7 68 AA BD 84 4B B3 43 A2 53 41 AD 29 BD 9E 70 +0200 | 5B 1B B8 EE DF EA E6 AC 6C 77 5D B2 B3 32 4C 4E +0210 | 02 A8 4E FC 10 80 DD B2 2B 56 8C 58 FF 05 E6 33 +0220 | DD 7D 86 8E AD C5 DE 69 E4 41 84 96 4E 26 0E 14 +0230 | 6E 4C A1 66

Payload (de)serialization:

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;
message_id 8, 801F447F44549A166013421966E4CA166 Message ID generated as specified here » (unixtime() << 32) + (N*4)
message_length 16, 4C0020000 (704 in decimal)78020000 (632 in decimal) Message body length
nonce 24, 16C3FA31687FB14AFE6EBB7BF5D87B574C6387AFED6602EEC4BE34FFABCB783146 Value generated by client in Step 1
server_nonce 40, 1693548E81C9C9937BEF21FBBF00907EFF9181A50F01240CA85879086C850C6C58 Value received from server in Step 2
encrypted_answer 56, 596FE5002006A393656637B0E0603AF890D A2167E32E3ED238B94568CAB848C8889 624398C371357CA7F78B336790C73CBB FB490DC2380C7AF49E6DE40DD62A24AF 730F139B71F8FFD973430659768386AE 23054696D4FDE3E59D9D7D89A00A6C25 FFB3F5BFCE9B0D7C4CF136488691F948 0CB49BFA85DF226ECE7D31278855A7B5 24E4256C08AE142B144342633F4B27A8 78A07E7808CFE65718737F7521B40DBF 7B6B43C8504B968CF17AF43CF98571E2 DA7182D3096F683FBC230ED755FA0C35 8FE5137708CFCDDEF40BFA49561ECE35 32F9135490D9B08E339EFED46389D854 4B99C573607296830AEBB6FCF8E03875 A910AE1D7F865AA1349AF54D3C439A8E 2E6539715302BD2F1E3E7F72E9711724 DEB969FAD67F12C77CACC131D0F97931 38CADAB8AA378CDD308CD5F81677F461 69B1339FA82B0B226E1E0AF68FE78366 97F6D04AE741A8BEC293EEE713DAD190 4EA3AED996D2B745510CB51B4E9F4B28 398E189AAFE7DC0461C7EC3750178869 41DA19A446CD450C9A1070F34C5FE758 94A955541326881BC0609EB22D83E326 CE0F42ED0C4E25E94D576A5143A84992 57E27F2704C1CF2E43F7723531DFF090 26A3943DF1C872F2584B4E50F0F82F70 6E9CCEB543F5807C6090F59A5C1711AD 4D15F42B355E4DB29121640897C0E5BA C16AC7D7B292FF4B0B39329F75A52F12 6F478DDB61073B85AD16356CE62CC6EE EC25B6B2DAE36D369E14F255B686A5A6 5C89B9240FD480AAA309643ED87873F1 B8C76C4DEAD32B9B7DB2EB1975E322B4 0B1335D336A2A61DAFBDFC5D0897D2FD 532E3129991EC3B5672E75EF49746200
367F59E6
FE50020024D0297FB1578EB57D1BB090 DE7DDBB084CEB33A48CA1A7CD1BD38AD B0E7CE35DE207C038551827BB7A38AF8 5388AAA9B64C8A7F28E6A0B74AFEBDEB 11911A19C77F68551FB0BB18C2B6042E A0443D17C759A00F88E1B919D5F61361 7275C4F714B7E3E42C1346CF37CFB7E4 05DC835221DC3B8DB4FECE96063C5EB4 95ED1B1DA2A480F4A1F27C285E8176C4 188A283A0F0BEEF9093A058F3F69091C 39E666F097BD0BB2AE47BC46CCEB1B95 6C510018F627D62C70D2B72BAC7B0BDC CE187C326D66458EE22E63159BE2C1A2 F77563D7C3F20FE888FAFBB67BCB18BB AD5B491848D53BA9D84CD4B831F67F44 7BDC686C9EB7EE7B17C9C00D426FC4FB 127CD14DB42BF7EA052ED15D9D5EDF2F C06AF175B328E6A53AA6B5320780746C 7C811A50235DE7E35D08E44D522C4A17 63B68489BDA36FB7F60BFE174302DC72 50DC0F0C9A8A2AA9652BDE11569208B8 24539A954C12EE41C0892D80E443E20B E24AB36576F68C67CC90360E85FCC192 552DC423F6BA1165F22378F8B392915F 891EDC57C15B64AC0BEF3F4E075F9C4B EEFB9A4EF30EEB4A8203EE6051109D97 DEF147B76C42AAB3C72746C4D70E2648 AC7935B721AD64009EC5A519DF85BAED 490EEBCAC069821D710FD1657DD729FC 5B7769B87D3E9017C90F34EFC1393CA1 B1E4AC2EFE2D53E158E77A8FED952B66 2781B3192F4447EB44C4A8C8CAECDA02 63FF7459612D530D4BF53322B44E92E0 2EA5E84CC22BD7C016C81DF2FA98DEBE B73D5D8AC8D36D034260785276C26169 A2197A7407C4D35327EF7767C5C85602 A209341215D16D00786CE83066CFE3B6
21526EEF
See below
@@ -570,13 +570,13 @@ answer = BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EF - + - + @@ -594,13 +594,13 @@ answer = BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EF - + - + @@ -609,34 +609,34 @@ answer = BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EF
7) Client computes random 2048-bit number b (using a sufficient amount of entropy) and sends the server a message

First, generate a secure random 2048-bit number b:

-
b = AB2EB055179E334D17B7EC7E62484A8D586449EE0CCBAE778158632715172B3242B86DDC88802ADF21E68910394A465818320374D839831869F333B504B725F3F28F38D6FE8099463F18FB32532718B2ECD57382199E14A539E441D2E50EFA2F81B8EF41B29B043E756A2DE044BF89D2F642DF510BF16EE9F460E6CB95A72B7CB2E1B6769159E379AA74055D3C28E304F23D58BA3B431844C962DB1094C9E1EA5E9E0172E8C864F0C5AE1E5C24877C8108D0971CCA80CC647444A52A0427B7FB11CF9FC03201ACBC409E8C2F1E5B9D20BBADA60E5A711DABFE191E7BBBC60403292A7D3F75725B72898D822D25690D67956787B5CE6328689029E483094526E5
+
b = AF7377821F4A9AD25A2BA317730937A3852EC889E1EE846D52D8847A731DD1EB1625F623DDA1EAF34E96B6B5734D036A4A635EA7DCCC5A413DEE6DF0FE00BF555215612BC3092F68859788BE46C9672AD4EEF080B297AEBA45FED1C6821A0764CFCEDF2FBB8CFD21C0F2A7A9DF24586610CAA82763FDD6E236601C4080B3E44671DEB8486CEFDD53CA18A3008466ACF7B746CB5AB67026B2E791CA535A7A1ED8E87E762400360E1DECE1AA9F117CCAF9492354661B2F8A869F3D5D182CC8538366167512F8FCA58A54E9179D88E415DC57826D7BE026AB623106298EA0D9B01DE8D1A36DECB903B006787E7899E72DD7D4FEF2EAE08684039CF2F6381D5ED5F2

Then compute g_b = pow(g, b) mod dh_prime

-
g_b = 64294D850864834E4E34CA5B05E8999B469C131BF388CC9048AE632F46BC1F0BD2CFD88CD9D20D88672D6D01650E5138A9D3F9FB091D5828C4C0A6398524F0A0DB7B3DE7D8E1C884000E23294B2D684180A5F796DE64760FA723460B79C7C3862D163656B121F4522C5845F00290EC91B89BFBF08C6E80E957D35F33B3004169A47C4C546E704DE6B0EF7668C55D86CD1DBC327A86AB597ECF7846789A2DC5E1E153994C0DED01D3DAE773359E3F3A0BE41EA65163BE2B52C4CB8E1248E82B6FB09B89929BCFDEF2786E40345CE67895251F874E0B3EE7661B8FDE81162129699731034E8915F04DF1493D6C73CC0BDFC404C5BA0E2AEFBC11B8B817C5D4670E
+
g_b = 1CA04FBD754009365B8FF282703B55FA9F7D69CB6A2CE521C355F750865FB2A2F75B2788FDB3B19ACA8F7C25334D042E8D9363181E01844D6B573B45A53172E29025E53BA90749951B1CE528DCDBC30BADF95340BAB141050864D02529D81136CCE69F88DCEDEA0AD9251E5D8F57C2B1EFC873C2993B635484C2E83807D7833A4DF6AEE22D614651452DB36F4A0ABE5A5C679CCD88CA874290672DC71644B5FC6D374BA3F4C9976860D6F5CCC50E66E3F30DDBA74AF340FC3629E99863E40903C42BFFDEAC80F2524543DD0887D0FFFBFACE0775B7EC64F4F5452C800DAFE4A2A342229EA3234A0838910A3E52D6CF8CA0C83D7612863174688F341E5E9169DA
7.1) generation of encrypted_data

Generated payload (excluding transport headers/trailers):

-
0000 | 54 B6 43 66 C3 FA 31 68 7F B1 4A FE 6E BB 7B F5
-0010 | D8 7B 57 4C 93 54 8E 81 C9 C9 93 7B EF 21 FB BF
-0020 | 00 90 7E FF 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
-0040 | 46 9C 13 1B F3 88 CC 90 48 AE 63 2F 46 BC 1F 0B
-0050 | D2 CF D8 8C D9 D2 0D 88 67 2D 6D 01 65 0E 51 38
-0060 | A9 D3 F9 FB 09 1D 58 28 C4 C0 A6 39 85 24 F0 A0
-0070 | DB 7B 3D E7 D8 E1 C8 84 00 0E 23 29 4B 2D 68 41
-0080 | 80 A5 F7 96 DE 64 76 0F A7 23 46 0B 79 C7 C3 86
-0090 | 2D 16 36 56 B1 21 F4 52 2C 58 45 F0 02 90 EC 91
-00A0 | B8 9B FB F0 8C 6E 80 E9 57 D3 5F 33 B3 00 41 69
-00B0 | A4 7C 4C 54 6E 70 4D E6 B0 EF 76 68 C5 5D 86 CD
-00C0 | 1D BC 32 7A 86 AB 59 7E CF 78 46 78 9A 2D C5 E1
-00D0 | E1 53 99 4C 0D ED 01 D3 DA E7 73 35 9E 3F 3A 0B
-00E0 | E4 1E A6 51 63 BE 2B 52 C4 CB 8E 12 48 E8 2B 6F
-00F0 | B0 9B 89 92 9B CF DE F2 78 6E 40 34 5C E6 78 95
-0100 | 25 1F 87 4E 0B 3E E7 66 1B 8F DE 81 16 21 29 69
-0110 | 97 31 03 4E 89 15 F0 4D F1 49 3D 6C 73 CC 0B DF
-0120 | C4 04 C5 BA 0E 2A EF BC 11 B8 B8 17 C5 D4 67 0E
+
0000 | 54 B6 43 66 63 87 AF ED 66 02 EE C4 BE 34 FF AB
+0010 | CB 78 31 46 91 81 A5 0F 01 24 0C A8 58 79 08 6C
+0020 | 85 0C 6C 58 00 00 00 00 00 00 00 00 FE 00 01 00
+0030 | 1C A0 4F BD 75 40 09 36 5B 8F F2 82 70 3B 55 FA
+0040 | 9F 7D 69 CB 6A 2C E5 21 C3 55 F7 50 86 5F B2 A2
+0050 | F7 5B 27 88 FD B3 B1 9A CA 8F 7C 25 33 4D 04 2E
+0060 | 8D 93 63 18 1E 01 84 4D 6B 57 3B 45 A5 31 72 E2
+0070 | 90 25 E5 3B A9 07 49 95 1B 1C E5 28 DC DB C3 0B
+0080 | AD F9 53 40 BA B1 41 05 08 64 D0 25 29 D8 11 36
+0090 | CC E6 9F 88 DC ED EA 0A D9 25 1E 5D 8F 57 C2 B1
+00A0 | EF C8 73 C2 99 3B 63 54 84 C2 E8 38 07 D7 83 3A
+00B0 | 4D F6 AE E2 2D 61 46 51 45 2D B3 6F 4A 0A BE 5A
+00C0 | 5C 67 9C CD 88 CA 87 42 90 67 2D C7 16 44 B5 FC
+00D0 | 6D 37 4B A3 F4 C9 97 68 60 D6 F5 CC C5 0E 66 E3
+00E0 | F3 0D DB A7 4A F3 40 FC 36 29 E9 98 63 E4 09 03
+00F0 | C4 2B FF DE AC 80 F2 52 45 43 DD 08 87 D0 FF FB
+0100 | FA CE 07 75 B7 EC 64 F4 F5 45 2C 80 0D AF E4 A2
+0110 | A3 42 22 9E A3 23 4A 08 38 91 0A 3E 52 D6 CF 8C
+0120 | A0 C8 3D 76 12 86 31 74 68 8F 34 1E 5E 91 69 DA

Payload (de)serialization:

client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:string = Client_DH_Inner_Data;
nonce 4, 16C3FA31687FB14AFE6EBB7BF5D87B574C6387AFED6602EEC4BE34FFABCB783146 Value generated by client in Step 1
server_nonce 20, 1693548E81C9C9937BEF21FBBF00907EFF9181A50F01240CA85879086C850C6C58 Value received from server in Step 2
g_a 300, 260FE0001006F7B20B65478004B0FFAFBE7 C96EA5EB35B8CED549CDF7C2B950F7E4 B813DCF2F1E0566D7E2AB00D5F3AADE5 43648D2BE878EE9CBEB8ADA694580644 339F1CC73FC96DB2028328EFB62AA8D9 AFC68F7C58373382813B5C39228E3F1A F42B0150C9FA09F7CA96332360B7B021 CF3B6C6F22B9F881593997C5EB9315F3 504119A983A93BC2CBEB48EDAADEE189 C2E2E1370A5E01172854E7B700A81E4D B92BF0BF8B836988C27502237F862B65 C6E98C1A095E9699096347551F949284 611DCBDC29428044AA7D31A09E4E25E1 D4A064146085721B64E010AD51DAC6E5 DFFAAC4E478636E596C044C50EF6495F 2AFB70AA802884757F3F5DDA30CCF3AA
4AD65CBE
FE00010061A54F355453D62BA850E1DE B2B9577E0ADFA00EF2B6A78426054AA8 860885A2169064A4596EBF4CC332B564 EC7594E841A8658355698A403EEF98C3 D777919475A8311E62ECA435DBEC740F 8BB8677C6A7650542872F24967352E83 EEB889A44588DE6C8B380F7F69617EEE 1C11344E3CB123DD27550D752E87567D ED6E1CFE21ED4D517855E71E08BE0FC5 144837BADB8CD899CA09E16C778CC9BD D7FC548D316F56EC204601F70E7C0103 978014067D4BA5271C1D261CCCFA79CF 5F6D6B47D768AABD844BB343A25341AD 29BD9E705B1BB8EEDFEAE6AC6C775DB2 B3324C4E02A84EFC1080DDB22B568C58 FF05E633DD7D868EADC5DE69E4418496
4E260E14
g_a diffie-hellman parameter
server_time 560, 44549A166 (1721846085 in decimal)6E4CA166 (1721846894 in decimal) Server time
@@ -658,19 +658,19 @@ answer = BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EF - + - + - + @@ -684,47 +684,47 @@ answer = BA0D89B5C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EF

The serialization of Client_DH_Inner_Data produces a string data. This is used to generate encrypted_data as specified in step 6, using the following inputs:

-
data = 54B64366C3FA31687FB14AFE6EBB7BF5D87B574C93548E81C9C9937BEF21FBBF00907EFF0000000000000000FE00010064294D850864834E4E34CA5B05E8999B469C131BF388CC9048AE632F46BC1F0BD2CFD88CD9D20D88672D6D01650E5138A9D3F9FB091D5828C4C0A6398524F0A0DB7B3DE7D8E1C884000E23294B2D684180A5F796DE64760FA723460B79C7C3862D163656B121F4522C5845F00290EC91B89BFBF08C6E80E957D35F33B3004169A47C4C546E704DE6B0EF7668C55D86CD1DBC327A86AB597ECF7846789A2DC5E1E153994C0DED01D3DAE773359E3F3A0BE41EA65163BE2B52C4CB8E1248E82B6FB09B89929BCFDEF2786E40345CE67895251F874E0B3EE7661B8FDE81162129699731034E8915F04DF1493D6C73CC0BDFC404C5BA0E2AEFBC11B8B817C5D4670E
-padding = 8DF91167272E406E5A93395C
-tmp_aes_key = 12E80C711D4E145929DBD59D74C4C9C784B465D36C86484EDB794E373343523A
-tmp_aes_iv = E46740B6386AD583BC7C143BDF4332C678F9CDC8EAB6EB4E602EBEF48E82B2E5
+
data = 54B643666387AFED6602EEC4BE34FFABCB7831469181A50F01240CA85879086C850C6C580000000000000000FE0001001CA04FBD754009365B8FF282703B55FA9F7D69CB6A2CE521C355F750865FB2A2F75B2788FDB3B19ACA8F7C25334D042E8D9363181E01844D6B573B45A53172E29025E53BA90749951B1CE528DCDBC30BADF95340BAB141050864D02529D81136CCE69F88DCEDEA0AD9251E5D8F57C2B1EFC873C2993B635484C2E83807D7833A4DF6AEE22D614651452DB36F4A0ABE5A5C679CCD88CA874290672DC71644B5FC6D374BA3F4C9976860D6F5CCC50E66E3F30DDBA74AF340FC3629E99863E40903C42BFFDEAC80F2524543DD0887D0FFFBFACE0775B7EC64F4F5452C800DAFE4A2A342229EA3234A0838910A3E52D6CF8CA0C83D7612863174688F341E5E9169DA
+padding = 7D41867F9FBED9344D62FB68
+tmp_aes_key = 87A16D7D6F2AED65D4FDB26C6F77466043B2F2DB09F5CB131C091193BA7493A5
+tmp_aes_iv = 2EF58137AFB5123EADA871026C9DEB69207A69AD90ADC7FACA1570495E493CEC

Process:

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);

Output:

-
encrypted_data = C9E9C04B8D4F439A80A87AA9AAAE846464EEBA70FCD941D99B8189A9F825C85647EF27A9D73A085D98F864A321D16823DB15684D9576B3CC0E5CB0DCC520A18BC7851C926657CEF82E93DBF1238CADE8854C274FABFEED6C34687335131E7A1DAFAB9DA83D940E33D65C6D15518A15540C48E1335F855241D58ABB4E20B763318847DE93FCC651E039CAC3868895DC400DD7DC9DC36D75AA0638C63B84F8B40AA6E9A25BB48A42425F772D001782D97357EC3946AEBEA16426FB2C4BECD8BD30125AE25644576BC59B53385F299D69AE4245D3D811E335439A5F09C989D58F85B5C8E10977219F071578E141A568D5D98D1E174BAE85602E3B89D8AB26BA19492EEA9CBEF5164FA553CD472F15B411796084972BAC0331B835B952E5E02C50DE5BA2E2EB3F3F33D6C3B6ACD005B79E4BACEA665490DA5FCED36D7305F9756ADAE17F1391B170203702C97083AEE08F14
+
encrypted_data = 128050427D220458D6D465483BD6792A75C2B14E84C610B3F6DD61C61D726D602F62BD7271C61C6D535A72AF63DFA8CCC375D246D9E64D985DCEA9C2A42CF76C2BEC2A275B578EFD27B054ABF7C088FEDBEA46C3DA5AD096B09C6B1E4256A08D37ECE8F6EE7B47B142AE7DA9816D41587471D443197ECCF0683AB25EAD6A2FDD696D6D752EAF2A12865AA504CBA16B7F39A18B9BAAE6103F539B56FA7D49D16E944041DDA3468F895FAA157164A7269A22D1EFD825F6BB01F0C784FA78E52182146AF568D6825818359C70EAA655C59019B534DC7F96B4D8A75589859B41BBD93624095D1A3D1BB4DBAAB42949F0E76627F4BB838BAC71AADA4A545496490C5DCBB4AE9397D89B837B00A01A2BD7961CF50E7F8A6FD804475E28F76E5006462F69C8989C2B0D1665D0542DE9BD04C70F165885F4DA49997199866990492C7B652FE2729BA002F4967CB4980844249F82

The length of the final string is 336 bytes.

7.2) set_client_DH_params query

Sent payload (excluding transport headers/trailers):

-
0000 | 00 00 00 00 00 00 00 00 1C 6F 0E 00 45 49 A1 66
-0010 | 78 01 00 00 1F 5F 04 F5 C3 FA 31 68 7F B1 4A FE
-0020 | 6E BB 7B F5 D8 7B 57 4C 93 54 8E 81 C9 C9 93 7B
-0030 | EF 21 FB BF 00 90 7E FF FE 50 01 00 C9 E9 C0 4B
-0040 | 8D 4F 43 9A 80 A8 7A A9 AA AE 84 64 64 EE BA 70
-0050 | FC D9 41 D9 9B 81 89 A9 F8 25 C8 56 47 EF 27 A9
-0060 | D7 3A 08 5D 98 F8 64 A3 21 D1 68 23 DB 15 68 4D
-0070 | 95 76 B3 CC 0E 5C B0 DC C5 20 A1 8B C7 85 1C 92
-0080 | 66 57 CE F8 2E 93 DB F1 23 8C AD E8 85 4C 27 4F
-0090 | AB FE ED 6C 34 68 73 35 13 1E 7A 1D AF AB 9D A8
-00A0 | 3D 94 0E 33 D6 5C 6D 15 51 8A 15 54 0C 48 E1 33
-00B0 | 5F 85 52 41 D5 8A BB 4E 20 B7 63 31 88 47 DE 93
-00C0 | FC C6 51 E0 39 CA C3 86 88 95 DC 40 0D D7 DC 9D
-00D0 | C3 6D 75 AA 06 38 C6 3B 84 F8 B4 0A A6 E9 A2 5B
-00E0 | B4 8A 42 42 5F 77 2D 00 17 82 D9 73 57 EC 39 46
-00F0 | AE BE A1 64 26 FB 2C 4B EC D8 BD 30 12 5A E2 56
-0100 | 44 57 6B C5 9B 53 38 5F 29 9D 69 AE 42 45 D3 D8
-0110 | 11 E3 35 43 9A 5F 09 C9 89 D5 8F 85 B5 C8 E1 09
-0120 | 77 21 9F 07 15 78 E1 41 A5 68 D5 D9 8D 1E 17 4B
-0130 | AE 85 60 2E 3B 89 D8 AB 26 BA 19 49 2E EA 9C BE
-0140 | F5 16 4F A5 53 CD 47 2F 15 B4 11 79 60 84 97 2B
-0150 | AC 03 31 B8 35 B9 52 E5 E0 2C 50 DE 5B A2 E2 EB
-0160 | 3F 3F 33 D6 C3 B6 AC D0 05 B7 9E 4B AC EA 66 54
-0170 | 90 DA 5F CE D3 6D 73 05 F9 75 6A DA E1 7F 13 91
-0180 | B1 70 20 37 02 C9 70 83 AE E0 8F 14
+
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 63 87 AF ED 66 02 EE C4
+0020 | BE 34 FF AB CB 78 31 46 91 81 A5 0F 01 24 0C A8
+0030 | 58 79 08 6C 85 0C 6C 58 FE 50 01 00 12 80 50 42
+0040 | 7D 22 04 58 D6 D4 65 48 3B D6 79 2A 75 C2 B1 4E
+0050 | 84 C6 10 B3 F6 DD 61 C6 1D 72 6D 60 2F 62 BD 72
+0060 | 71 C6 1C 6D 53 5A 72 AF 63 DF A8 CC C3 75 D2 46
+0070 | D9 E6 4D 98 5D CE A9 C2 A4 2C F7 6C 2B EC 2A 27
+0080 | 5B 57 8E FD 27 B0 54 AB F7 C0 88 FE DB EA 46 C3
+0090 | DA 5A D0 96 B0 9C 6B 1E 42 56 A0 8D 37 EC E8 F6
+00A0 | EE 7B 47 B1 42 AE 7D A9 81 6D 41 58 74 71 D4 43
+00B0 | 19 7E CC F0 68 3A B2 5E AD 6A 2F DD 69 6D 6D 75
+00C0 | 2E AF 2A 12 86 5A A5 04 CB A1 6B 7F 39 A1 8B 9B
+00D0 | AA E6 10 3F 53 9B 56 FA 7D 49 D1 6E 94 40 41 DD
+00E0 | A3 46 8F 89 5F AA 15 71 64 A7 26 9A 22 D1 EF D8
+00F0 | 25 F6 BB 01 F0 C7 84 FA 78 E5 21 82 14 6A F5 68
+0100 | D6 82 58 18 35 9C 70 EA A6 55 C5 90 19 B5 34 DC
+0110 | 7F 96 B4 D8 A7 55 89 85 9B 41 BB D9 36 24 09 5D
+0120 | 1A 3D 1B B4 DB AA B4 29 49 F0 E7 66 27 F4 BB 83
+0130 | 8B AC 71 AA DA 4A 54 54 96 49 0C 5D CB B4 AE 93
+0140 | 97 D8 9B 83 7B 00 A0 1A 2B D7 96 1C F5 0E 7F 8A
+0150 | 6F D8 04 47 5E 28 F7 6E 50 06 46 2F 69 C8 98 9C
+0160 | 2B 0D 16 65 D0 54 2D E9 BD 04 C7 0F 16 58 85 F4
+0170 | DA 49 99 71 99 86 69 90 49 2C 7B 65 2F E2 72 9B
+0180 | A0 02 F4 96 7C B4 98 08 44 24 9F 82

Payload (de)serialization:

set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:string = Set_client_DH_params_answer;
nonce 4, 16C3FA31687FB14AFE6EBB7BF5D87B574C6387AFED6602EEC4BE34FFABCB783146 Value generated by client in Step 1
server_nonce 20, 1693548E81C9C9937BEF21FBBF00907EFF9181A50F01240CA85879086C850C6C58 Value received from server in Step 2
g_b 36, 260FE00010064294D850864834E4E34CA5B 05E8999B469C131BF388CC9048AE632F 46BC1F0BD2CFD88CD9D20D88672D6D01 650E5138A9D3F9FB091D5828C4C0A639 8524F0A0DB7B3DE7D8E1C884000E2329 4B2D684180A5F796DE64760FA723460B 79C7C3862D163656B121F4522C5845F0 0290EC91B89BFBF08C6E80E957D35F33 B3004169A47C4C546E704DE6B0EF7668 C55D86CD1DBC327A86AB597ECF784678 9A2DC5E1E153994C0DED01D3DAE77335 9E3F3A0BE41EA65163BE2B52C4CB8E12 48E82B6FB09B89929BCFDEF2786E4034 5CE67895251F874E0B3EE7661B8FDE81 162129699731034E8915F04DF1493D6C 73CC0BDFC404C5BA0E2AEFBC11B8B817
C5D4670E
FE0001001CA04FBD754009365B8FF282 703B55FA9F7D69CB6A2CE521C355F750 865FB2A2F75B2788FDB3B19ACA8F7C25 334D042E8D9363181E01844D6B573B45 A53172E29025E53BA90749951B1CE528 DCDBC30BADF95340BAB141050864D025 29D81136CCE69F88DCEDEA0AD9251E5D 8F57C2B1EFC873C2993B635484C2E838 07D7833A4DF6AEE22D614651452DB36F 4A0ABE5A5C679CCD88CA874290672DC7 1644B5FC6D374BA3F4C9976860D6F5CC C50E66E3F30DDBA74AF340FC3629E998 63E40903C42BFFDEAC80F2524543DD08 87D0FFFBFACE0775B7EC64F4F5452C80 0DAFE4A2A342229EA3234A0838910A3E 52D6CF8CA0C83D7612863174688F341E
5E9169DA
Single-byte prefix denoting length, a 256-byte (2048-bit) string, and zero bytes of padding
@@ -746,7 +746,7 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);< - + @@ -764,19 +764,19 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);< - + - + - + @@ -785,17 +785,17 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);<
8) Auth key generation

The client computes the auth_key using formula g_a^b mod dh_prime:

-
auth_key = A065B2F30D9858452D2EB37BC81FA871BED25C11A31619CAFEAAC43658B8119CF5BDA5AB5904F6B50B71ACE7B6A8F7C1DA1536EED58264DEA994B9BA0374E37EA71C4BA46A108CEC9385C08E78E2080F26A995D54CBC035449029FB026AADDF157D4D85319E16E5D8DCD40A038A4600512A15432CF017BCAEC020E7D290A7D0BD4143F0211B2D660AEFEB399E9AF6B4912CCF68D368A289E18B784528ABAB310F58A8D6EA9525F99BDF8C142D616CEBB3EF5E74C6CF3B9D1453D2D82816D06EEF67CAD8F72C5E3892AFDBB542C2F357FC3DA0783A491A00E4B60510990DD9A77586FED0B1A1ECF8D3473DDBBCAD08F22501E6611E7E0D7EB0440CEA5816AE8D4
+
auth_key = 41BF02FB10F92AC40FC93D22820D05D943FAAFDC3D5B03F814409357751ABDCE81334CCD6BBDF5EBF0BCB127ED1989FA40D52C45C93C0CA4120A299E23BEEDA657ABDD4495CED827F3E87AA7DC13804EE1C80DE61DDAE5B28357450AA42D2D00600A5A354BC1936A55A337103342E9A4809839EE69CF01B36DCEAAC03815AA2C681261581ECE75E2F4AC5C32733966A5F25F0822A6233B8EC464F4415F9862F04A51D6D42662DDFBB2CE40735A80DEA7023325216DE430FC470B8EFD55803B1EA98053F1A926D322FD90EF2F21B8319F655459CABAA827DB379B7B7D59A1866D78AE919E23E21399432891C857BF4DF5946E8070107586EC4DBDC1190564293B
9) Final server reply

The server verifies and confirms that auth_key_hash is unique: since it's unique, it replies with the following:

Received payload (excluding transport headers/trailers):

-
0000 | 00 00 00 00 00 00 00 00 01 64 DF 98 46 49 A1 66
-0010 | 6C 00 00 00 34 F7 CB 3B C3 FA 31 68 7F B1 4A FE
-0020 | 6E BB 7B F5 D8 7B 57 4C 93 54 8E 81 C9 C9 93 7B
-0030 | EF 21 FB BF 00 90 7E FF AD 66 69 D7 7F 9C D3 AE
-0040 | FE 6D C0 37 21 4B 62 81
+
0000 | 00 00 00 00 00 00 00 00 01 B0 01 1E 6F 4C A1 66
+0010 | 90 00 00 00 34 F7 CB 3B 63 87 AF ED 66 02 EE C4
+0020 | BE 34 FF AB CB 78 31 46 91 81 A5 0F 01 24 0C A8
+0030 | 58 79 08 6C 85 0C 6C 58 7F 1F 84 10 80 7A 10 EB
+0040 | 7C 48 40 9D A8 D9 F1 03

Payload (de)serialization:

dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer;
message_id 8, 81C6F0E004549A166F4280E006E4CA166 Message ID generated as specified here » (unixtime() << 32) + (N*4)
nonce 24, 16C3FA31687FB14AFE6EBB7BF5D87B574C6387AFED6602EEC4BE34FFABCB783146 Value generated by client in Step 1
server_nonce 40, 1693548E81C9C9937BEF21FBBF00907EFF9181A50F01240CA85879086C850C6C58 Value received from server in Step 2
encrypted_data 56, 340FE500100C9E9C04B8D4F439A80A87AA9 AAAE846464EEBA70FCD941D99B8189A9 F825C85647EF27A9D73A085D98F864A3 21D16823DB15684D9576B3CC0E5CB0DC C520A18BC7851C926657CEF82E93DBF1 238CADE8854C274FABFEED6C34687335 131E7A1DAFAB9DA83D940E33D65C6D15 518A15540C48E1335F855241D58ABB4E 20B763318847DE93FCC651E039CAC386 8895DC400DD7DC9DC36D75AA0638C63B 84F8B40AA6E9A25BB48A42425F772D00 1782D97357EC3946AEBEA16426FB2C4B ECD8BD30125AE25644576BC59B53385F 299D69AE4245D3D811E335439A5F09C9 89D58F85B5C8E10977219F071578E141 A568D5D98D1E174BAE85602E3B89D8AB 26BA19492EEA9CBEF5164FA553CD472F 15B411796084972BAC0331B835B952E5 E02C50DE5BA2E2EB3F3F33D6C3B6ACD0 05B79E4BACEA665490DA5FCED36D7305 F9756ADAE17F1391B170203702C97083
AEE08F14
FE500100128050427D220458D6D46548 3BD6792A75C2B14E84C610B3F6DD61C6 1D726D602F62BD7271C61C6D535A72AF 63DFA8CCC375D246D9E64D985DCEA9C2 A42CF76C2BEC2A275B578EFD27B054AB F7C088FEDBEA46C3DA5AD096B09C6B1E 4256A08D37ECE8F6EE7B47B142AE7DA9 816D41587471D443197ECCF0683AB25E AD6A2FDD696D6D752EAF2A12865AA504 CBA16B7F39A18B9BAAE6103F539B56FA 7D49D16E944041DDA3468F895FAA1571 64A7269A22D1EFD825F6BB01F0C784FA 78E52182146AF568D6825818359C70EA A655C59019B534DC7F96B4D8A7558985 9B41BBD93624095D1A3D1BB4DBAAB429 49F0E76627F4BB838BAC71AADA4A5454 96490C5DCBB4AE9397D89B837B00A01A 2BD7961CF50E7F8A6FD804475E28F76E 5006462F69C8989C2B0D1665D0542DE9 BD04C70F165885F4DA49997199866990 492C7B652FE2729BA002F4967CB49808
44249F82
Encrypted client_DH_inner_data generated previously, serialized as a TL byte string
@@ -817,13 +817,13 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);< - + - + @@ -835,19 +835,19 @@ encrypted_data := AES256_ige_encrypt (data_with_hash, tmp_aes_key, tmp_aes_iv);< - + - + - +
message_id 8, 80164DF984649A16601B0011E6F4CA166 Message ID generated as specified here » (unixtime() << 32) + (N*4)
message_length 16, 46C000000 (108 in decimal)90000000 (144 in decimal) Message body length
nonce 24, 16C3FA31687FB14AFE6EBB7BF5D87B574C6387AFED6602EEC4BE34FFABCB783146 Value generated by client in Step 1
server_nonce 40, 1693548E81C9C9937BEF21FBBF00907EFF9181A50F01240CA85879086C850C6C58 Value received from server in Step 2
new_nonce_hash1 56, 16AD6669D77F9CD3AEFE6DC037214B62817F1F8410807A10EB7C48409DA8D9F103 The 128 lower-order bits of SHA1 of the byte string derived from the new_nonce string by adding a single byte with the value of 1, 2, or 3, and followed by another 8 bytes with auth_key_aux_hash. Different values are required to prevent an intruder from changing server response dh_gen_ok into dh_gen_retry.