import hashlib


def md5(filename):
    """Hash function for files to be uploaded to Fl33t"""

    md5hash = hashlib.md5()
    with open(filename, "rb") as filehandle:
        for chunk in iter(lambda: filehandle.read(4096), b""):
            md5hash.update(chunk)
    return md5hash.hexdigest()