title: Parsing decrypted encrypted_data in Telegram
body: <p>I am trying to implement receiving/sending messages via Secret chat in Telegram (~something like own client), but encountered some problems while interpreting decrypted data. I've read the <a href="https://core.telegram.org/mtproto/description#encrypted-message-encrypted-data" rel="nofollow noreferrer">schema</a>, but can't match it with my data.</p>
  
  <p>To be more concrete: I received a message (sent from the official client) with word "Test12", the decoded result (in hex) was:</p>
  
  <p>3C0000008917E31B0FF1C770B657C36AF705BDACA4BE2C0B2E0000000100000062000000DE91B0360000000038507C7CD5FA6F7C00 <em>00000006</em> <strong>546573743132</strong> 00</p>
  
  <p>We can find here the whole message starting from 57 byte (bold), and (if I'm not mistaken) the length (italic). But how can I match other bytes? It is said in schema that message should start from 8 (salt) + 8 (session_id) + 8 (message_id) + 4 (seq_no) + 4 (message_data_length) = 32 byte, not from 57 byte.</p>
  
  <p>Moreover when I try to send longer message (more than ~256 bytes), the "message text" is starting from 60 byte and length is also encoded a little bit strange: FE000400 for 1024-byte message and FE000200 for 512-bytes (what does FE mean?).</p>
  
  <p>So, can anyone please give me a schema or a clue of what I'm doing wrong?</p>