Add md5it.py
This commit is contained in:
13
md5it.py
Normal file
13
md5it.py
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import hashlib
|
||||
BLOCKSIZE=65536
|
||||
files = [f for f in os.listdir('.') if os.path.isfile(f)]
|
||||
for f in files:
|
||||
md5=hashlib.md5()
|
||||
with open(f,'rb') as fd:
|
||||
fb=fd.read(BLOCKSIZE)
|
||||
while len(fb)>0:
|
||||
md5.update(fb)
|
||||
fb=fd.read(BLOCKSIZE)
|
||||
os.rename(f,md5.hexdigest())
|
||||
Reference in New Issue
Block a user