当前位置: 首页>>代码示例>>Python>>正文


Python util.run_cipher方法代码示例

本文整理汇总了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) 
开发者ID:PaperDashboard,项目名称:shadowsocks,代码行数:18,代码来源:openssl.py

示例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) 
开发者ID:ntfreedom,项目名称:neverendshadowsocks,代码行数:7,代码来源:sodium.py

示例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) 
开发者ID:ntfreedom,项目名称:neverendshadowsocks,代码行数:8,代码来源:sodium.py

示例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) 
开发者ID:ntfreedom,项目名称:neverendshadowsocks,代码行数:9,代码来源:table.py

示例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) 
开发者ID:ntfreedom,项目名称:neverendshadowsocks,代码行数:9,代码来源:rc4_md5.py

示例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) 
开发者ID:ntfreedom,项目名称:neverendshadowsocks,代码行数:8,代码来源:openssl.py

示例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) 
开发者ID:shadowsocksr-backup,项目名称:shadowsocksr,代码行数:9,代码来源:ctypes_libsodium.py

示例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) 
开发者ID:shadowsocksr-backup,项目名称:shadowsocksr,代码行数:9,代码来源:ctypes_libsodium.py

示例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) 
开发者ID:shadowsocksr-backup,项目名称:shadowsocksr,代码行数:9,代码来源:ctypes_openssl.py

示例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) 
开发者ID:huaisha1224,项目名称:ShadowSocks-Client,代码行数:9,代码来源:table.py

示例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) 
开发者ID:huaisha1224,项目名称:ShadowSocks-Client,代码行数:9,代码来源:rc4_md5.py

示例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) 
开发者ID:hao35954514,项目名称:shadowsocksR-b,代码行数:8,代码来源:sodium.py


注:本文中的shadowsocks.crypto.util.run_cipher方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。