src/dirbs/utils.py
def compute_md5_hash(file, buf_size=65536):
    """
    Utility method to generate a md5 hash of file.

    Arguments:
        file: file object in memory to read
        buf_size: buffer size for read() function, default is 65536
    Returns:
        md5 hash of the file
    """
    md5_hash = hashlib.md5()
    while True:
        data = file.read(buf_size)
        if not data:
            break
        md5_hash.update(data)

    return md5_hash.hexdigest()

    Utility method to generate a md5 hash of file.

    Arguments:
        file: file object in memory to read
        buf_size: buffer size for read() function, default is 65536
    Returns:
        md5 hash of the file
    
Utility method to generate a md5 hash of file.
Utility method to generate a md5 hash of file .
def compute_md5_hash(file, buf_size=65536):
    md5_hash = hashlib.md5()
    while True:
        data = file.read(buf_size)
        if not data:
            break
        md5_hash.update(data)
    return md5_hash.hexdigest()
def compute_md5_hash ( file , buf_size = 65536 ) : md5_hash = hashlib . md5 ( ) while True : data = file . read ( buf_size ) if not data : break md5_hash . update ( data ) return md5_hash . hexdigest ( )
Utility method to generate a md5 hash of file.
Utility method to generate a md5 hash of file .
"""
    Utility method to generate a md5 hash of file.

    Arguments:
        file: file object in memory to read
        buf_size: buffer size for read() function, default is 65536
    Returns:
        md5 hash of the file
    """
md5 hash of the file
md5 hash of the file
file
file object in memory to read
file object in memory to read
buf_size
buffer size for read() function, default is 65536
buffer size for read () function default is 65536