Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
b11f386b
Commit
b11f386b
authored
Dec 31, 2012
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working on rc4
parent
bfa0f1cf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
8 deletions
+21
-8
assets/shadowsocks
assets/shadowsocks
+0
-0
jni/shadowsocks/encrypt.c
jni/shadowsocks/encrypt.c
+19
-6
jni/shadowsocks/encrypt.h
jni/shadowsocks/encrypt.h
+2
-2
libs/armeabi/pdnsd
libs/armeabi/pdnsd
+0
-0
libs/armeabi/shadowsocks
libs/armeabi/shadowsocks
+0
-0
No files found.
assets/shadowsocks
View file @
b11f386b
No preview for this file type
jni/shadowsocks/encrypt.c
View file @
b11f386b
...
...
@@ -113,8 +113,9 @@ static void mergesort(uint8_t array[], int length)
void
encrypt
(
char
*
buf
,
int
len
)
{
if
(
_method
==
RC4_ENC
)
{
int
outlen
;
unsigned
char
mybuf
[
BUF_SIZE
];
RC4
(
&
rc4_key
,
len
,
(
unsigned
char
*
)
buf
,
mybuf
);
EVP_CipherUpdate
(
&
ctx
,
mybuf
,
&
outlen
,
(
unsigned
char
*
)
buf
,
len
);
memcpy
(
buf
,
mybuf
,
len
);
}
else
{
char
*
end
=
buf
+
len
;
...
...
@@ -127,8 +128,9 @@ void encrypt(char *buf, int len) {
void
decrypt
(
char
*
buf
,
int
len
)
{
if
(
_method
==
RC4_ENC
)
{
int
outlen
;
unsigned
char
mybuf
[
BUF_SIZE
];
RC4
(
&
rc4_key
,
len
,
(
unsigned
char
*
)
buf
,
mybuf
);
EVP_CipherUpdate
(
&
ctx
,
mybuf
,
&
outlen
,
(
unsigned
char
*
)
buf
,
len
);
memcpy
(
buf
,
mybuf
,
len
);
}
else
{
char
*
end
=
buf
+
len
;
...
...
@@ -154,13 +156,24 @@ int recv_decrypt(int sock, char *buf, int len, int flags) {
return
result
;
}
void
get_table
(
const
char
*
key
)
{
void
get_table
(
const
char
*
pass
)
{
if
(
_method
==
RC4_ENC
)
{
RC4_set_key
(
&
rc4_key
,
strlen
(
key
),
(
unsigned
char
*
)
key
);
unsigned
char
key
[
EVP_MAX_KEY_LENGTH
];
unsigned
char
iv
[
EVP_MAX_IV_LENGTH
];
int
key_len
=
EVP_BytesToKey
(
EVP_rc4
(),
EVP_md5
(),
NULL
,
(
unsigned
char
*
)
pass
,
strlen
(
pass
),
1
,
key
,
iv
);
EVP_CIPHER_CTX_init
(
&
ctx
);
EVP_CipherInit_ex
(
&
ctx
,
EVP_rc4
(),
NULL
,
NULL
,
NULL
,
1
);
if
(
!
EVP_CIPHER_CTX_set_key_length
(
&
ctx
,
key_len
))
{
LOGE
(
"Invalid key length: %d"
,
key_len
);
EVP_CIPHER_CTX_cleanup
(
&
ctx
);
exit
(
EXIT_FAILURE
);
}
EVP_CipherInit_ex
(
&
ctx
,
NULL
,
NULL
,
key
,
iv
,
1
);
}
else
{
uint8_t
*
table
=
encrypt_table
;
uint8_t
*
tmp_hash
=
MD5
((
const
uint8_t
*
)
key
,
strlen
(
key
),
NULL
);
_a
=
htole64
(
*
(
uint64_t
*
)
tmp_hash
);
uint8_t
*
tmp_hash
=
MD5
((
unsigned
char
*
)
pass
,
strlen
(
pass
),
NULL
);
_a
=
htole64
(
*
(
uint64_t
*
)
tmp_hash
);
uint32_t
i
;
for
(
i
=
0
;
i
<
256
;
++
i
)
{
...
...
jni/shadowsocks/encrypt.h
View file @
b11f386b
...
...
@@ -5,7 +5,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <openssl/md5.h>
#include <openssl/
rc4
.h>
#include <openssl/
evp
.h>
#include <endian.h>
#define BUF_SIZE 4096
...
...
@@ -15,7 +15,7 @@
unsigned
char
encrypt_table
[
256
];
unsigned
char
decrypt_table
[
256
];
RC4_KEY
rc4_key
;
EVP_CIPHER_CTX
ctx
;
void
get_table
(
const
char
*
key
);
void
encrypt
(
char
*
buf
,
int
len
);
...
...
libs/armeabi/pdnsd
View file @
b11f386b
No preview for this file type
libs/armeabi/shadowsocks
View file @
b11f386b
No preview for this file type
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