Пример #1
0
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
Пример #2
0
def getFileMd5(fileName):
    from pclib import copystream, hashstream
    result = hashstream('md5')
    with open(fileName, 'rb') as f:
        copystream(f, result)
    return result.digest()