import hashlib


def hash_data(data, entropy_H):
    """Calculate MD5/SHA1/SHA256 of given data

    Args:
        data (bytes): Data to calculate hashes/entropy
        entropy_H (pefile.SectionStructure.entropy_H): Callback function for calculating entropy

    Returns:
        dict: Dictionary of hashes/entropy

    """
    md5 = hashlib.md5()
    sha1 = hashlib.sha1()
    sha256 = hashlib.sha256()

    md5.update(data)
    sha1.update(data)
    sha256.update(data)

    return {"md5": md5.hexdigest(), "sha1": sha1.hexdigest(), "sha256": sha256.hexdigest(), "entropy": entropy_H(data), "size": len(data)}