def recalculateCommitMD5(commit, bundle): with DebugInfo('Recalculating commit md5') as d: from histo.server.get import openDataCodes from pclib import hashstream hasher = hashstream('md5') with openDataCodes(bundle, commit) as f: from pclib import copystream copystream(f, hasher) result = hasher.digest() from pclib import byteshex d.result = byteshex.encode(result) return result
def getFileMd5(fileName): from pclib import copystream, hashstream result = hashstream('md5') with open(fileName, 'rb') as f: copystream(f, result) return result.digest()