Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mtproto_proxy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mtproto_proxy
Commits
9b8f382b
Unverified
Commit
9b8f382b
authored
May 26, 2019
by
Сергей Прохоров
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mtp_obfuscated: specify some binary part sizes
parent
24ef8277
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
mtp_obfuscated.erl
src/mtp_obfuscated.erl
+4
-4
No files found.
src/mtp_obfuscated.erl
View file @
9b8f382b
...
...
@@ -64,11 +64,11 @@ client_create(Seed, Secret, Protocol, DcId) when byte_size(Seed) == 58,
%% init_up_encrypt/2
<<
_:
8
/
binary
,
ToRev
:(
?
KEY_LEN
+
?
IV_LEN
)
/
binary
,
_
/
binary
>>
=
Raw
,
<<
DecKeySeed
:
?
KEY_LEN
/
binary
,
DecIv
:
?
IV_LEN
/
binary
>>
=
bin_rev
(
ToRev
),
DecKey
=
crypto
:
hash
(
'sha256'
,
<<
DecKeySeed
/
binary
,
Secret
/
binary
>>
),
DecKey
=
crypto
:
hash
(
'sha256'
,
<<
DecKeySeed
:
?
KEY_LEN
/
binary
,
Secret
:
16
/
binary
>>
),
%% init_up_decrypt/2
<<
_:
8
/
binary
,
EncKeySeed
:
?
KEY_LEN
/
binary
,
EncIv
:
?
IV_LEN
/
binary
,
_
/
binary
>>
=
Raw
,
EncKey
=
crypto
:
hash
(
'sha256'
,
<<
EncKeySeed
/
binary
,
Secret
/
binary
>>
),
EncKey
=
crypto
:
hash
(
'sha256'
,
<<
EncKeySeed
:
?
KEY_LEN
/
binary
,
Secret
:
16
/
binary
>>
),
Codec
=
new
(
EncKey
,
EncIv
,
DecKey
,
DecIv
),
{
<<
_:
56
/
binary
,
Encrypted
:
8
/
binary
>>
,
Codec1
}
=
encrypt
(
Raw
,
Codec
),
...
...
@@ -138,12 +138,12 @@ init_up_encrypt(Bin, Secret) ->
Rev
=
bin_rev
(
ToRev
),
<<
KeySeed
:
?
KEY_LEN
/
binary
,
IV
:
?
IV_LEN
/
binary
>>
=
Rev
,
%% <<_:32/binary, RevIV:16/binary, _/binary>> = Bin,
Key
=
crypto
:
hash
(
'sha256'
,
<<
KeySeed
/
binary
,
Secret
/
binary
>>
),
Key
=
crypto
:
hash
(
'sha256'
,
<<
KeySeed
:
?
KEY_LEN
/
binary
,
Secret
:
16
/
binary
>>
),
{
Key
,
IV
}.
init_up_decrypt
(
Bin
,
Secret
)
->
<<
_:
8
/
binary
,
KeySeed
:
?
KEY_LEN
/
binary
,
IV
:
?
IV_LEN
/
binary
,
_
/
binary
>>
=
Bin
,
Key
=
crypto
:
hash
(
'sha256'
,
<<
KeySeed
/
binary
,
Secret
/
binary
>>
),
Key
=
crypto
:
hash
(
'sha256'
,
<<
KeySeed
:
?
KEY_LEN
/
binary
,
Secret
:
16
/
binary
>>
),
{
Key
,
IV
}.
get_protocol
(
<<
16#ef
,
16#ef
,
16#ef
,
16#ef
,
_:
2
/
binary
>>
)
->
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment