我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用hashlib.sha3_512()。
def __get_builtin_constructor(name): if name in set(['sha3_224', 'sha3_256', 'sha3_384', 'sha3_512', 'SHA3_224', 'SHA3_256', 'SHA3_384', 'SHA3_512']): bs = name[5:] if bs == '224': return sha3_224 elif bs == '256': return sha3_256 elif bs == '384': return sha3_384 elif bs == '512': return sha3_512 return _hashlib_constructor(name)
def test_hashlib_sha3(self): import hashlib import sha3 self.assertIsNotNone(hashlib.sha3_512()) self.assertIsNotNone(sha3.keccak_512())
def setup(self, arg): self.h = hashlib.sha3_512()
def pwd_hash(plain: str, salt: str) -> str: """Generate a hash for a password using SHA3-512.""" return hashlib.sha3_512(f'{plain}{salt}'.encode()).hexdigest()