def do_get(args): path = args.path if args.get_md5: logging.info(hex_middle_md5(path))
def load_md5(self, path): #offset = (self.file_size - MediaFile.MD5_CONTENT_LEN) / 2 #length = MediaFile.MD5_CONTENT_LEN self.middle_md5 = hex_middle_md5(path)
from hashlib import md5 import sys import os sys.path.append( os.path.abspath( os.path.join(os.path.dirname( os.path.realpath(__file__) ), '..') )) import exif from exif.myexif import calc_middle_md5 from exif import hex_middle_md5 from exif import cmp_file path = '/Users/min/Pictures/DSC_0001.JPG' print hex_middle_md5(path), hex_middle_md5(path, True) print cmp_file(path, path) def test_calc_middle_md5(): #calc_middle_md5('/Volumes/sg2/01Photos/2016/201604/Raw/DSC_0161.NEF') calc_middle_md5(sys.argv[1]) print 'test_calc_middle_md5', timeit.timeit('test_calc_middle_md5()', 'from __main__ import test_calc_middle_md5', number=1000) default_recursion_limit = sys.getrecursionlimit() sys.setrecursionlimit(10001) def recursive_md5(s, count, n): ret = md5(s).digest() count += 1 if count >= n: