import hashlib
import base64


def get_hash(data):
    """Auxiliary function used in HTTP communication to S3 bucket.

    Parameters
    ----------
    event : bytearray
        Raw data.

    Returns
    -------
    tuple
        md5 hash and the same hash encoded in base64
    """
    md5_hash = hashlib.md5()
    md5_hash.update(data)
    encoded = base64.b64encode(md5_hash.digest()).decode('utf8')
    digest = md5_hash.hexdigest()
    return encoded, digest