我尝试在用字符串编码base64之后比较值。但是encode64
不等于Uy6qvZV0iA2/drm4zACDLCCm7BE9aCKZVQ16bg80XiU=
为什么不等于?你知道吗
import hashlib
hash_object = hashlib.sha256(b'Test')
hex_dig = hash_object.hexdigest()
encode64 = hex_dig.decode('hex').encode('base64')
print(encode64)
if encode64 == 'Uy6qvZV0iA2/drm4zACDLCCm7BE9aCKZVQ16bg80XiU=' :
print("Hello")
输出
Uy6qvZV0iA2/drm4zACDLCCm7BE9aCKZVQ16bg80XiU=
它不打印Hello。你知道吗
encode64变量末尾有一个“\n”。 你能做到的
相关问题 更多 >
编程相关推荐