首页 > 解决方案 > sha256 哈希长度

问题描述

我想从字符串中获取哈希 sha256,因为 sha256 的长度为 256 位,每个字节的大小为 8 位,我认为哈希的长度(在字符串中)必须是 32 个字符(256/8 = 32)。但哈希长度为 64 个字符。谁能帮我?

print(hashlib.sha256('lsd'.encode()).hexdigest())

输出:

3fd7dcbd130286b3799aa74e7fcb1d2ecc80d4c95a158d91dfa1d6a72557f769

哈希长度是64,不应该是32吗?

标签: hashsha256sha

解决方案


推荐阅读