本文整理匯總了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)