有没有办法将十六进制代码转换回SHA256对象?

2024-10-06 15:23:08 发布

您现在位置:Python中文网/ 问答频道 /正文

如何将SHA256生成的hexcode转换回SHA256对象

digest = SHA256.new()      # digest empty
digest.update(str(data).encode())   # digest has string hashed
hex_code = digest.hexcode()

hexcode包含数据摘要,现在有没有办法将hexcode转换回SHA256对象

是否有任何方法可以使用十六进制代码来生成原始摘要对象

'print(digest) gives
 <Crypto.Hash.SHA256.SHA256Hash object at 0x7fc2e2ea4da0>
print(digest.hexcode()) gives
bc273cf180e376f52d8c8a7f6b6ffd5babb872629e5fcc4685fe5284887faee'

有没有什么方法可以使用digest.hexcode()生成哈希对象


Tags: 对象方法newdatastringupdateencodeempty