from typing import Tuple
import struct


def unpack_nist_signature(sig: bytes) -> Tuple[bytes, bytes]:
    """Unpack message and signature from a signature with the encoding of the NIST PQC competition"""

    (siglen,) = struct.unpack_from("<I", sig)
    msglen = len(sig) - siglen - 4
    return sig[4 : 4 + msglen], sig[4 + msglen :]