當前位置: 首頁>>代碼示例>>Python>>正文


Python algorithms.IDEA屬性代碼示例

本文整理匯總了Python中cryptography.hazmat.primitives.ciphers.algorithms.IDEA屬性的典型用法代碼示例。如果您正苦於以下問題:Python algorithms.IDEA屬性的具體用法?Python algorithms.IDEA怎麽用?Python algorithms.IDEA使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在cryptography.hazmat.primitives.ciphers.algorithms的用法示例。


在下文中一共展示了algorithms.IDEA屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: cipher

# 需要導入模塊: from cryptography.hazmat.primitives.ciphers import algorithms [as 別名]
# 或者: from cryptography.hazmat.primitives.ciphers.algorithms import IDEA [as 別名]
def cipher(self):
        bs = {SymmetricKeyAlgorithm.IDEA: algorithms.IDEA,
              SymmetricKeyAlgorithm.TripleDES: algorithms.TripleDES,
              SymmetricKeyAlgorithm.CAST5: algorithms.CAST5,
              SymmetricKeyAlgorithm.Blowfish: algorithms.Blowfish,
              SymmetricKeyAlgorithm.AES128: algorithms.AES,
              SymmetricKeyAlgorithm.AES192: algorithms.AES,
              SymmetricKeyAlgorithm.AES256: algorithms.AES,
              SymmetricKeyAlgorithm.Twofish256: namedtuple('Twofish256', ['block_size'])(block_size=128),
              SymmetricKeyAlgorithm.Camellia128: algorithms.Camellia,
              SymmetricKeyAlgorithm.Camellia192: algorithms.Camellia,
              SymmetricKeyAlgorithm.Camellia256: algorithms.Camellia}

        if self in bs:
            return bs[self]

        raise NotImplementedError(repr(self)) 
開發者ID:SecurityInnovation,項目名稱:PGPy,代碼行數:19,代碼來源:constants.py

示例2: key_size

# 需要導入模塊: from cryptography.hazmat.primitives.ciphers import algorithms [as 別名]
# 或者: from cryptography.hazmat.primitives.ciphers.algorithms import IDEA [as 別名]
def key_size(self):
        ks = {SymmetricKeyAlgorithm.IDEA: 128,
              SymmetricKeyAlgorithm.TripleDES: 192,
              SymmetricKeyAlgorithm.CAST5: 128,
              SymmetricKeyAlgorithm.Blowfish: 128,
              SymmetricKeyAlgorithm.AES128: 128,
              SymmetricKeyAlgorithm.AES192: 192,
              SymmetricKeyAlgorithm.AES256: 256,
              SymmetricKeyAlgorithm.Twofish256: 256,
              SymmetricKeyAlgorithm.Camellia128: 128,
              SymmetricKeyAlgorithm.Camellia192: 192,
              SymmetricKeyAlgorithm.Camellia256: 256}

        if self in ks:
            return ks[self]

        raise NotImplementedError(repr(self)) 
開發者ID:SecurityInnovation,項目名稱:PGPy,代碼行數:19,代碼來源:constants.py

示例3: is_insecure

# 需要導入模塊: from cryptography.hazmat.primitives.ciphers import algorithms [as 別名]
# 或者: from cryptography.hazmat.primitives.ciphers.algorithms import IDEA [as 別名]
def is_insecure(self):
        insecure_ciphers = {SymmetricKeyAlgorithm.IDEA}
        return self in insecure_ciphers 
開發者ID:SecurityInnovation,項目名稱:PGPy,代碼行數:5,代碼來源:constants.py

示例4: test_bad_cryptography_module_attribute_usage

# 需要導入模塊: from cryptography.hazmat.primitives.ciphers import algorithms [as 別名]
# 或者: from cryptography.hazmat.primitives.ciphers.algorithms import IDEA [as 別名]
def test_bad_cryptography_module_attribute_usage(self):
        python_node = self.get_ast_node(
            """
            import cryptography.hazmat.primitives.hashes
            import cryptography.hazmat.primitives.ciphers.modes
            import cryptography.hazmat.primitives.ciphers.algorithms
            import cryptography.hazmat.primitives.asymmetric.padding

            cryptography.hazmat.primitives.hashes.MD5
            cryptography.hazmat.primitives.hashes.SHA1
            cryptography.hazmat.primitives.ciphers.modes.ECB
            cryptography.hazmat.primitives.ciphers.algorithms.Blowfish
            cryptography.hazmat.primitives.ciphers.algorithms.ARC4
            cryptography.hazmat.primitives.ciphers.algorithms.IDEA
            cryptography.hazmat.primitives.asymmetric.padding.PKCS1v15
            """
        )

        linter = dlint.linters.BadCryptographyModuleAttributeUseLinter()
        linter.visit(python_node)

        result = linter.get_results()
        expected = [
            dlint.linters.base.Flake8Result(
                lineno=7,
                col_offset=0,
                message=dlint.linters.BadCryptographyModuleAttributeUseLinter._error_tmpl
            ),
            dlint.linters.base.Flake8Result(
                lineno=8,
                col_offset=0,
                message=dlint.linters.BadCryptographyModuleAttributeUseLinter._error_tmpl
            ),
            dlint.linters.base.Flake8Result(
                lineno=9,
                col_offset=0,
                message=dlint.linters.BadCryptographyModuleAttributeUseLinter._error_tmpl
            ),
            dlint.linters.base.Flake8Result(
                lineno=10,
                col_offset=0,
                message=dlint.linters.BadCryptographyModuleAttributeUseLinter._error_tmpl
            ),
            dlint.linters.base.Flake8Result(
                lineno=11,
                col_offset=0,
                message=dlint.linters.BadCryptographyModuleAttributeUseLinter._error_tmpl
            ),
            dlint.linters.base.Flake8Result(
                lineno=12,
                col_offset=0,
                message=dlint.linters.BadCryptographyModuleAttributeUseLinter._error_tmpl
            ),
            dlint.linters.base.Flake8Result(
                lineno=13,
                col_offset=0,
                message=dlint.linters.BadCryptographyModuleAttributeUseLinter._error_tmpl
            ),
        ]

        assert result == expected 
開發者ID:duo-labs,項目名稱:dlint,代碼行數:63,代碼來源:test_bad_cryptography_module_attribute_use.py

示例5: test_bad_cryptography_module_attribute_usage_from_import

# 需要導入模塊: from cryptography.hazmat.primitives.ciphers import algorithms [as 別名]
# 或者: from cryptography.hazmat.primitives.ciphers.algorithms import IDEA [as 別名]
def test_bad_cryptography_module_attribute_usage_from_import(self):
        python_node = self.get_ast_node(
            """
            from cryptography.hazmat.primitives import hashes
            from cryptography.hazmat.primitives.ciphers import modes
            from cryptography.hazmat.primitives.ciphers import algorithms
            from cryptography.hazmat.primitives.asymmetric import padding

            hashes.MD5
            hashes.SHA1
            modes.ECB
            algorithms.Blowfish
            algorithms.ARC4
            algorithms.IDEA
            padding.PKCS1v15
            """
        )

        linter = dlint.linters.BadCryptographyModuleAttributeUseLinter()
        linter.visit(python_node)

        result = linter.get_results()
        expected = [
            dlint.linters.base.Flake8Result(
                lineno=7,
                col_offset=0,
                message=dlint.linters.BadCryptographyModuleAttributeUseLinter._error_tmpl
            ),
            dlint.linters.base.Flake8Result(
                lineno=8,
                col_offset=0,
                message=dlint.linters.BadCryptographyModuleAttributeUseLinter._error_tmpl
            ),
            dlint.linters.base.Flake8Result(
                lineno=9,
                col_offset=0,
                message=dlint.linters.BadCryptographyModuleAttributeUseLinter._error_tmpl
            ),
            dlint.linters.base.Flake8Result(
                lineno=10,
                col_offset=0,
                message=dlint.linters.BadCryptographyModuleAttributeUseLinter._error_tmpl
            ),
            dlint.linters.base.Flake8Result(
                lineno=11,
                col_offset=0,
                message=dlint.linters.BadCryptographyModuleAttributeUseLinter._error_tmpl
            ),
            dlint.linters.base.Flake8Result(
                lineno=12,
                col_offset=0,
                message=dlint.linters.BadCryptographyModuleAttributeUseLinter._error_tmpl
            ),
            dlint.linters.base.Flake8Result(
                lineno=13,
                col_offset=0,
                message=dlint.linters.BadCryptographyModuleAttributeUseLinter._error_tmpl
            ),
        ]

        assert result == expected 
開發者ID:duo-labs,項目名稱:dlint,代碼行數:63,代碼來源:test_bad_cryptography_module_attribute_use.py


注:本文中的cryptography.hazmat.primitives.ciphers.algorithms.IDEA屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。