Skip to main content

A package for computing the algebraic immunity and restricted algebraic immunity of Boolean functions.

Project description

algebraic_immunity

Documentation

Rust implementation of the algebraic immunity abd restricted algebraic immunity computation of Boolean functions, based on the papers
"Efficient Computation of Algebraic Immunity for Algebraic and Fast Algebraic Attacks"
(Armknecht et al., 2006, DOI: https://doi.org/10.1007/11761679_8) and "Computing the Restricted Algebraic Immunity, and Application to WPB Functions"
Luca Bonamino and Pierrick Méaux. IACR ePrint 2025/1779 .

This Rust implementation is wrapped as a Python package using PyO3 (https://pyo3.rs) and maturin (https://github.com/PyO3/maturin).

Why This Implementation?

This library was developed to provide a robust and reliable implementation of algebraic immunity computation. It addresses a correctness issue in SageMath’s BooleanFunction.algebraic_immunity() method, which can raise internal errors or produce incorrect results for certain Boolean functions — particularly those with two variables, such as [1, 0, 0, 1].

This Rust implementation has been tested extensively and is suitable for both small and large truth tables, with a focus on correctness and Python accessibility.


Installation

You can install the package via PyPI or use the pre-built wheels provided in the GitHub releases.

✅ Installation via PyPI

To install the package directly from PyPI:

pip install algebraic_immunity

Installation via Pre-built Wheels

If PyPI installation doesn't work for your platform, you can use the pre-built wheels:

  1. Run the following script to determine the correct wheel for your platform:
python construct_wheel_url.py
  1. Then install the wheel using:
pip install <output of the previous command>

Usage Example (Python)

from algebraic_immunity import AlgebraicImmunity, BooleanFunction

# Algebraic immunity
truth_table = [0, 1, 1, 1, 1, 0, 0, 1]
n = 3
ai = AlgebraicImmunity.ai(truth_table, n)
print(f"Algebraic immunity: {ai}")

bf = BooleanFunction(truth_table)
ai = bf.algebraic_immunity()
print(f"Algebraic immunity: {ai}")

# Restricted algebraic immunity
restricted_ai = AlgebraicImmunity.restricted_ai(truth_table, [0,2] ,n)
print(f"Restricted algebraic immunity: {restricted_ai}")

bf = BooleanFunction(truth_table)
restricted_ai = bf.restricted_algebraic_immunity([0,2])
print(f"Restricted algebraic immunity: {restricted_ai}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

algebraic_immunity-1.2.0-cp310-cp310-win_amd64.whl (189.5 kB view details)

Uploaded CPython 3.10Windows x86-64

algebraic_immunity-1.2.0-cp310-cp310-win32.whl (177.0 kB view details)

Uploaded CPython 3.10Windows x86

algebraic_immunity-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (351.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

algebraic_immunity-1.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (348.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

algebraic_immunity-1.2.0-cp310-cp310-macosx_11_0_arm64.whl (304.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

algebraic_immunity-1.2.0-cp310-cp310-macosx_10_12_x86_64.whl (306.9 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

Details for the file algebraic_immunity-1.2.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for algebraic_immunity-1.2.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 84c793daba8ab4564be7b620f3c049780965f10ed044933e1767d84c78f327b8
MD5 95c0f13e7a0795efd885514390d52e82
BLAKE2b-256 eea75540d17628ee35a4b2c0ad7b2d867fa551cf0969d9aa02c91fc528e739e2

See more details on using hashes here.

File details

Details for the file algebraic_immunity-1.2.0-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for algebraic_immunity-1.2.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 3031bc9e7d077ca56ba7a64496618652bf5b55b25285f829914971bd7467ef6e
MD5 ab44b058bf2b995bfa6c1f577bc26bb7
BLAKE2b-256 200c7402cbed534ebfff16377733b9e5e1274c0e2b5667a2f8cac6de214f0f6b

See more details on using hashes here.

File details

Details for the file algebraic_immunity-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for algebraic_immunity-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c74414d8ceb1bc21f33e79d0b1a0b8c5cd4e5cc71b92370590b6f83896e5297d
MD5 999ad0cca657e96d52b7b355e2768ed3
BLAKE2b-256 19bbc74453d942f78315ef09d865f2ffedce368dac82e3bb32a941f8777359a9

See more details on using hashes here.

File details

Details for the file algebraic_immunity-1.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for algebraic_immunity-1.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6d1a35dc026d57a81f66f795e9b75224d3573917217cc0f1861a70ecdcf9904e
MD5 556b0759353bcc0376f3aef2edfcd27d
BLAKE2b-256 ac2885f4e11d5ca95b9b2e27cbe70442af5a775ad724251890de531db28896c3

See more details on using hashes here.

File details

Details for the file algebraic_immunity-1.2.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for algebraic_immunity-1.2.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ff89045f503051b66b053c1ebb9b6481370343340aa70f2bd127797ba8c89bc7
MD5 593dfdbb01152fb0901987e2583259f9
BLAKE2b-256 43f93465cc4c9ade4761740ed717b8e48e3dac07b441786c3b07397bdb070bdc

See more details on using hashes here.

File details

Details for the file algebraic_immunity-1.2.0-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for algebraic_immunity-1.2.0-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 cf0c3be9fb106f4a62052c96e6e2565821280b75633d1d7e99e01f12efaa05db
MD5 48557729bf525cdb82b8f0d389940656
BLAKE2b-256 cf86b4175ff464392289c4adc4b98563d3dce5372b883cb3eb4f47292c0a9ccf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page