import hashlib


def sha256(byte_array) -> bytes:
    """
    Perform a SHA256 operation on the input.

    :param byte_array: data to hash.
    :type byte_array: bytearray or bytes

    :return: hashed data
    :rtype: bytes
    """
    return hashlib.sha256(byte_array).digest()