當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。