[英]How Do I Convert a Picture into a Sha256 Hash Python
是否可以将图片输入到 hashlib 的 sha256 功能中并让它使用 Python 吐出一个散列?
Maybe this helps?也许这有帮助? Link
关联
You have to import hashlib, open the file, and then calculate the hash.您必须导入 hashlib,打开文件,然后计算哈希。
import hashlib
filename = "Filepath to image file.png"
with open(filename,"rb") as f:
bytes = f.read() # read entire file as bytes
readable_hash = hashlib.sha256(bytes).hexdigest();
print(readable_hash)
签发证书详情
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.