Python MD5文件生成码
时间:2023-01-21 02:41:31
import md5
import sys
def sumfile(fobj):
m = md5.new()
while True:
d = fobj.read(8096)
if not d:
break
m.update(d)
return m.hexdigest()
def md5sum(fname):
if fname == '-':
ret = sumfile(sys.stdin)
else:
try:
f = file(fname, 'rb')
except:
return 'Failed to open file'
ret = sumfile(f)
f.close()
return ret
if __name__ == '__main__':
for fname in sys.argv[1:]:
print '%32s %s' % (md5sum(fname), fname)
标签:Python,MD5,文件生成码
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
PHP图像识别技术原理与实现
2024-06-05 09:43:54
![](https://img.aspxhome.com/file/2023/1/122501_0s.png)
一条select语句引起的瓶颈问题思考
2024-01-18 02:40:32
互联网产品设计零碎记
2010-09-25 12:49:00
![](https://img.aspxhome.com/file/UploadPic/20109/25/diedai-600x64-87s.png)
模拟兼容性的 inline-block 属性
2008-04-08 12:37:00
详解python中的线程与线程池
2022-02-02 18:27:19
Python使用代理抓取网站图片(多线程)
2023-06-25 17:34:50
django celery redis使用具体实践
2022-12-03 02:45:39
![](https://img.aspxhome.com/file/2023/5/87785_0s.png)
用一个例子来认识innerText,innerHTML
2007-12-24 17:17:00
网页设计中HTML常范的五个错误
2008-04-22 18:14:00
MySQL数据库的自动备份与数据库被破坏后的恢复
2010-03-18 15:30:00
Python字典使用技巧详解
2021-09-07 23:54:25
如何使用python写截屏小工具
2021-04-04 23:51:14
![](https://img.aspxhome.com/file/2023/7/86207_0s.gif)
python 批量添加的button 使用同一点击事件的方法
2022-10-11 20:13:46
详解MySQL数据库安全配置
2010-01-26 15:19:00
一文吃透Go的内置RPC原理
2024-02-03 08:45:53
![](https://img.aspxhome.com/file/2023/6/103736_0s.png)
安装sql server 2008 management提示已安装 SQL Server 2005 Express的解决方法
2024-01-15 12:49:03
python的random模块及加权随机算法的python实现方法
2023-09-04 13:32:57
python3爬虫之设计签名小程序
2021-09-16 00:26:46
![](https://img.aspxhome.com/file/2023/7/113167_0s.png)
Javascript(es2016) import和require用法和区别详解
2024-04-19 09:57:04
了解MySQL查询语句执行过程(5大组件)
2024-01-26 09:49:51
![](https://img.aspxhome.com/file/2023/2/106592_0s.png)