This commit is contained in:
clowwindy 2014-05-03 23:04:49 +08:00
parent ed39505dc1
commit fd4efca0fe
8 changed files with 45 additions and 8 deletions

View file

@ -4,7 +4,9 @@ python:
- 2.7
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq build-essential libssl-dev swig libevent-dev python-gevent python-m2crypto
- pip install gevent m2crypto
- sudo apt-get install -qq build-essential libssl-dev swig libevent-dev python-gevent python-m2crypto python-numpy
- pip install gevent m2crypto salsa20
script:
- python test.py
- python test.py -c test/table.json
- python test.py -c test/aes.json
- python test.py -c test/salsa20.json

View file

@ -21,7 +21,7 @@ Install Shadowsocks.
#### Debian / Ubuntu:
apt-get install python-gevent python-m2crypto
apt-get install python-pip python-gevent python-m2crypto
pip install shadowsocks
#### CentOS:
@ -94,6 +94,20 @@ You can use args to override settings from `config.json`.
ssserver -p server_port -k password -m bf-cfb
ssserver -c /etc/shadowsocks/config.json
Salsa20
-------
Salsa20 is a fast stream cipher.
Use "salsa20-ctr" in shadowsocks.json.
And install these packages:
#### Debian / Ubuntu:
apt-get install python-numpy
pip install salsa20
Wiki
----

View file

@ -4,7 +4,7 @@
"local_port":1080,
"password":"barfoo!",
"timeout":300,
"method":"table",
"method":"aes-256-cfb",
"local_address":"127.0.0.1",
"fast_open":false
}

View file

@ -151,7 +151,8 @@ class Encryptor(object):
if m:
key, iv_ = EVP_BytesToKey(password, m[0], m[1])
if iv is None:
iv = iv_[:m[1]]
iv = iv_
iv = iv[:m[1]]
if op == 1:
self.cipher_iv = iv[:m[1]] # this iv is for cipher not decipher
if method != 'salsa20-ctr':

View file

@ -82,9 +82,9 @@ decrypt_table = string.maketrans(encrypt_table, string.maketrans('', ''))
for i in range(0, 256):
assert(target2[0][i] == ord(encrypt_table[i]))
assert(target2[1][i] == ord(decrypt_table[i]))
p1 = Popen(['python', 'shadowsocks/server.py', '-c', 'test/config.json'], shell=False, bufsize=0, stdin=PIPE,
p1 = Popen(['python', 'shadowsocks/server.py', '-c', sys.argv[-1]], shell=False, bufsize=0, stdin=PIPE,
stdout=PIPE, stderr=PIPE, close_fds=True)
p2 = Popen(['python', 'shadowsocks/local.py', '-c', 'test/config.json'], shell=False, bufsize=0, stdin=PIPE,
p2 = Popen(['python', 'shadowsocks/local.py', '-c', sys.argv[-1]], shell=False, bufsize=0, stdin=PIPE,
stdout=PIPE, stderr=PIPE, close_fds=True)
p3 = None

10
test/salsa20.json Normal file
View file

@ -0,0 +1,10 @@
{
"server":"127.0.0.1",
"server_port":8388,
"local_port":1080,
"password":"barfoo!",
"timeout":300,
"method":"salsa20-ctr",
"local_address":"127.0.0.1",
"fast_open":false
}

10
test/table.json Normal file
View file

@ -0,0 +1,10 @@
{
"server":"127.0.0.1",
"server_port":8388,
"local_port":1080,
"password":"barfoo!",
"timeout":300,
"method":"table",
"local_address":"127.0.0.1",
"fast_open":false
}