代码拉取完成,页面将自动刷新
import hashlib
import sys
def calculate_sha256(file_path):
sha256_hash = hashlib.sha256()
with open(file_path, 'rb') as file:
for chunk in iter(lambda: file.read(4096), b''):
sha256_hash.update(chunk)
return sha256_hash.hexdigest()
def write_sha256_file(file_path, sha256sum):
output_file = file_path + '.sha256sum'
with open(output_file, 'w', newline='\n') as file:
file.write(sha256sum + ' ' + file_path)
if __name__ == '__main__':
if len(sys.argv) != 2:
print(f"usage: {__file__} <file_to_hash>")
sys.exit(1)
file_path = sys.argv[1]
sha256sum = calculate_sha256(file_path)
write_sha256_file(file_path, sha256sum)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。