我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用cryptography.hazmat.primitives.hashes.SHA224。
def _oaep_hash_supported(self, algorithm): if self._lib.Cryptography_HAS_RSA_OAEP_MD: return isinstance( algorithm, ( hashes.SHA1, hashes.SHA224, hashes.SHA256, hashes.SHA384, hashes.SHA512, ) ) else: return isinstance(algorithm, hashes.SHA1)
def hash_func(self): return { self.MD5: hashes.MD5, self.SHA1: hashes.SHA1, self.SHA224: hashes.SHA224, self.SHA256: hashes.SHA256, self.SHA384: hashes.SHA384, self.SHA512: hashes.SHA512, }[self]
def __init__(self): """ Construct a CryptographyEngine. """ self.logger = logging.getLogger('kmip.server.engine.cryptography') self._symmetric_key_algorithms = { enums.CryptographicAlgorithm.TRIPLE_DES: algorithms.TripleDES, enums.CryptographicAlgorithm.AES: algorithms.AES, enums.CryptographicAlgorithm.BLOWFISH: algorithms.Blowfish, enums.CryptographicAlgorithm.CAMELLIA: algorithms.Camellia, enums.CryptographicAlgorithm.CAST5: algorithms.CAST5, enums.CryptographicAlgorithm.IDEA: algorithms.IDEA, enums.CryptographicAlgorithm.RC4: algorithms.ARC4 } self._asymetric_key_algorithms = { enums.CryptographicAlgorithm.RSA: self._create_rsa_key_pair } self._hash_algorithms = { enums.CryptographicAlgorithm.HMAC_SHA1: hashes.SHA1, enums.CryptographicAlgorithm.HMAC_SHA224: hashes.SHA224, enums.CryptographicAlgorithm.HMAC_SHA256: hashes.SHA256, enums.CryptographicAlgorithm.HMAC_SHA384: hashes.SHA384, enums.CryptographicAlgorithm.HMAC_SHA512: hashes.SHA512, enums.CryptographicAlgorithm.HMAC_MD5: hashes.MD5 }