コード例 #1
0
def run_method(method):
    from shadowsocks.crypto import openssl

    print(method, ': [stream]', 32)
    cipher = MbedTLSStreamCrypto(method, b'k' * 32, b'i' * 16, 1)
    decipher = openssl.OpenSSLStreamCrypto(method, b'k' * 32, b'i' * 16, 0)

    util.run_cipher(cipher, decipher)
コード例 #2
0
def create_cipher(alg, key, iv, op, crypto_path=None,
                  key_as_bytes=0, d=None, salt=None,
                  i=1, padding=1):
    md5 = hashlib.md5()
    md5.update(key)
    md5.update(iv)
    rc4_key = md5.digest()
    return openssl.OpenSSLStreamCrypto(b'rc4', rc4_key, b'', op, crypto_path)