大佬教程收集整理的这篇文章主要介绍了在为Windows操作系统中的大文件计算SHA-1哈希时,Python崩溃,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
要么:
import sys import msvcrt import hashlib #Print the file name (and its LOCATIOn) to be hashed print 'File: ' + str(sys.argv[1]) #Set "SHA1Hash" equal to SHA-1 hash SHA1Hash = hashlib.sha1() #Open file specified by "sys.argv[1]" in read only (r) and binary (b) mode File = open(sys.argv[1],'rb') #Get the SHA-1 hash for the contents of the specified file SHA1Hash.update(File.read()) #Close the file File.close() #Set "SHA1HashBase16" equal to the hexa@R_450_6221@l of "SHA1Hash" SHA1HashBase16 = SHA1Hash.hexdigest() #Print the SHA-1 (hexa@R_450_6221@l) hash of the file print 'SHA-1: ' + SHA1HashBase16 #Make a blank line print ' ' #Print "Press any key to conTinue..." print 'Press any key to conTinue...' #"Press any key to conTinue..." delay char=0 while not char: char=msvcrt.getch()
* 更新 *
使用python脚本计算大文件的SHA-1哈希值.感谢Ignacio Vazquez-Abrams指出错误和Tom Zych的代码.
使用简单地拖放要在脚本顶部进行哈希处理的文件.或者,您可以使用命令提示符,使用:
SHA-1HashGen.py Path&File
以上是大佬教程为你收集整理的在为Windows操作系统中的大文件计算SHA-1哈希时,Python崩溃全部内容,希望文章能够帮你解决在为Windows操作系统中的大文件计算SHA-1哈希时,Python崩溃所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。