import hashlib


def hashed_observation_from_ephid(ephid, epoch):
    """Compute the hashed observation for a given epoch

    Computes SHA256(EphID || i) where i is the given epoch. Encoding is as
    follows:

      * First 16 bytes are the EphID
      * Next 4 bytes are the epoch number in BigEndian order

    Args:
        ephid (byte array): The observed EphID
        time (:obj:`datetime`): Time of observation
    """
    epoch_bytes = epoch.to_bytes(4, "big")
    result = hashlib.sha256(ephid + epoch_bytes).digest()
    return result