本文整理汇总了Python中shadowsocks.crypto.util.run_cipher方法的典型用法代码示例。如果您正苦于以下问题:Python util.run_cipher方法的具体用法?Python util.run_cipher怎么用?Python util.run_cipher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shadowsocks.crypto.util
的用法示例。
在下文中一共展示了util.run_cipher方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_aead_method_chunk
# 需要导入模块: from shadowsocks.crypto import util [as 别名]
# 或者: from shadowsocks.crypto.util import run_cipher [as 别名]
def run_aead_method_chunk(method, key_len=16):
print(method, ': chunk([size][tag][payload][tag]', key_len)
cipher = libcrypto.EVP_get_cipherbyname(common.to_bytes(method))
if not cipher:
cipher = load_cipher(common.to_bytes(method))
if not cipher:
print('cipher not avaiable, please upgrade openssl')
return
key_len = int(key_len)
cipher = OpenSSLAeadCrypto(method, b'k' * key_len, b'i' * key_len, 1)
decipher = OpenSSLAeadCrypto(method, b'k' * key_len, b'i' * key_len, 0)
cipher.encrypt_once = cipher.encrypt
decipher.decrypt_once = decipher.decrypt
util.run_cipher(cipher, decipher)
示例2: test_salsa20
# 需要导入模块: from shadowsocks.crypto import util [as 别名]
# 或者: from shadowsocks.crypto.util import run_cipher [as 别名]
def test_salsa20():
cipher = SodiumCrypto('salsa20', b'k' * 32, b'i' * 16, 1)
decipher = SodiumCrypto('salsa20', b'k' * 32, b'i' * 16, 0)
util.run_cipher(cipher, decipher)
示例3: test_chacha20
# 需要导入模块: from shadowsocks.crypto import util [as 别名]
# 或者: from shadowsocks.crypto.util import run_cipher [as 别名]
def test_chacha20():
cipher = SodiumCrypto('chacha20', b'k' * 32, b'i' * 16, 1)
decipher = SodiumCrypto('chacha20', b'k' * 32, b'i' * 16, 0)
util.run_cipher(cipher, decipher)
示例4: test_encryption
# 需要导入模块: from shadowsocks.crypto import util [as 别名]
# 或者: from shadowsocks.crypto.util import run_cipher [as 别名]
def test_encryption():
from shadowsocks.crypto import util
cipher = TableCipher('table', b'test', b'', 1)
decipher = TableCipher('table', b'test', b'', 0)
util.run_cipher(cipher, decipher)
示例5: test
# 需要导入模块: from shadowsocks.crypto import util [as 别名]
# 或者: from shadowsocks.crypto.util import run_cipher [as 别名]
def test():
from shadowsocks.crypto import util
cipher = create_cipher('rc4-md5', b'k' * 32, b'i' * 16, 1)
decipher = create_cipher('rc4-md5', b'k' * 32, b'i' * 16, 0)
util.run_cipher(cipher, decipher)
示例6: run_method
# 需要导入模块: from shadowsocks.crypto import util [as 别名]
# 或者: from shadowsocks.crypto.util import run_cipher [as 别名]
def run_method(method):
cipher = OpenSSLCrypto(method, b'k' * 32, b'i' * 16, 1)
decipher = OpenSSLCrypto(method, b'k' * 32, b'i' * 16, 0)
util.run_cipher(cipher, decipher)
示例7: test_salsa20
# 需要导入模块: from shadowsocks.crypto import util [as 别名]
# 或者: from shadowsocks.crypto.util import run_cipher [as 别名]
def test_salsa20():
from shadowsocks.crypto import util
cipher = Salsa20Crypto(b'salsa20', b'k' * 32, b'i' * 16, 1)
decipher = Salsa20Crypto(b'salsa20', b'k' * 32, b'i' * 16, 0)
util.run_cipher(cipher, decipher)
示例8: test_chacha20
# 需要导入模块: from shadowsocks.crypto import util [as 别名]
# 或者: from shadowsocks.crypto.util import run_cipher [as 别名]
def test_chacha20():
from shadowsocks.crypto import util
cipher = Salsa20Crypto(b'chacha20', b'k' * 32, b'i' * 16, 1)
decipher = Salsa20Crypto(b'chacha20', b'k' * 32, b'i' * 16, 0)
util.run_cipher(cipher, decipher)
示例9: run_method
# 需要导入模块: from shadowsocks.crypto import util [as 别名]
# 或者: from shadowsocks.crypto.util import run_cipher [as 别名]
def run_method(method):
from shadowsocks.crypto import util
cipher = CtypesCrypto(method, b'k' * 32, b'i' * 16, 1)
decipher = CtypesCrypto(method, b'k' * 32, b'i' * 16, 0)
util.run_cipher(cipher, decipher)
示例10: test_encryption
# 需要导入模块: from shadowsocks.crypto import util [as 别名]
# 或者: from shadowsocks.crypto.util import run_cipher [as 别名]
def test_encryption():
from shadowsocks.crypto import util
cipher = TableCipher(b'table', b'test', b'', 1)
decipher = TableCipher(b'table', b'test', b'', 0)
util.run_cipher(cipher, decipher)
示例11: test
# 需要导入模块: from shadowsocks.crypto import util [as 别名]
# 或者: from shadowsocks.crypto.util import run_cipher [as 别名]
def test():
from shadowsocks.crypto import util
cipher = create_cipher(b'rc4-md5', b'k' * 32, b'i' * 16, 1)
decipher = create_cipher(b'rc4-md5', b'k' * 32, b'i' * 16, 0)
util.run_cipher(cipher, decipher)
示例12: test_chacha20_ietf
# 需要导入模块: from shadowsocks.crypto import util [as 别名]
# 或者: from shadowsocks.crypto.util import run_cipher [as 别名]
def test_chacha20_ietf():
cipher = SodiumCrypto('chacha20-ietf', b'k' * 32, b'i' * 16, 1)
decipher = SodiumCrypto('chacha20-ietf', b'k' * 32, b'i' * 16, 0)
util.run_cipher(cipher, decipher)