Project

General

Profile

md5_calc.py

Alexander Moibenko, 01/16/2015 04:05 PM

 
1
import sys
2
import hashlib
3

    
4
def md5sum(filename, blocksize=65536):
5
    hash = hashlib.md5()
6
    with open(filename, "r+b") as f:
7
        for block in iter(lambda: f.read(blocksize), ""):
8
            hash.update(block)
9
    return hash.hexdigest()
10

    
11
print sys.argv[1]
12
print md5sum(sys.argv[1])