INNER CODE UNIT · Python

is_kem_enabled

open-quantum-safe/liboqs-python · oqs/oqs.py:578

def is_kem_enabled(alg_name: str) -> bool:
    """
    Return True if the KEM algorithm is enabled.

    :param alg_name: a KEM mechanism algorithm name.
    """
    return native().OQS_KEM_alg_is_enabled(ct.create_string_buffer(alg_name.encode()))


_KEM_alg_ids = [native().OQS_KEM_alg_identifier(i) for i in range(native().OQS_KEM_alg_count())]
_supported_KEMs: tuple[str, ...] = tuple([i.decode() for i in _KEM_alg_ids])  # noqa: N816
_enabled_KEMs: tuple[str, ...] = tuple([i for i in _supported_KEMs if is_kem_enabled(i)])  # noqa: N816


def get_enabled_kem_mechanisms() -> tuple[str, ...]:
    """Return the list of enabled KEM mechanisms."""
    return _enabled_KEMs

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…