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}")

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

Future Work

  • Parts of this repository are more broadly relevant to operations over GF(2) matrices. These components could be extracted into a standalone Rust crate in the future.
  • The current implementation sometimes uses the clone method unnecessarily to bypass Rust’s borrowing rules. These instances will be reviewed and optimized in future updates.

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.1.0-cp310-cp310-win_amd64.whl (189.7 kB view details)

Uploaded CPython 3.10Windows x86-64

algebraic_immunity-1.1.0-cp310-cp310-win32.whl (177.1 kB view details)

Uploaded CPython 3.10Windows x86

algebraic_immunity-1.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (351.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

algebraic_immunity-1.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (348.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

algebraic_immunity-1.1.0-cp310-cp310-macosx_11_0_arm64.whl (304.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

algebraic_immunity-1.1.0-cp310-cp310-macosx_10_12_x86_64.whl (307.0 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

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

File metadata

File hashes

Hashes for algebraic_immunity-1.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e948da76824c4e9ca49c82f9b3f26768c00cdf9bb24030c81a31b4b92ff21626
MD5 b9759db22a421dddeb2289ca402a9472
BLAKE2b-256 77c7843f91d1de81972d3c4ded3827192ab1f4a05651487deb066795c58ebb3b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for algebraic_immunity-1.1.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 6abd5c2219df0d7875ba948d54529e66ffd58309b685efca57950efbbac9062e
MD5 326ce0b049f329cd7567eda4b03cf418
BLAKE2b-256 44fadca6374601bfb9e504ec3e99a69b8bac04bb6b6a2e6d7c9c7d4d8503eeda

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for algebraic_immunity-1.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 231198bbb41b74105d5a4aa44140cec4ca989661a11f8bf66d11d08539abfc35
MD5 e3bdc43feafd4ae7d7b015883eabc6c9
BLAKE2b-256 7068e775d296b36843e50f051d6f4dfc8b79091368f1bd441432475f217c90ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for algebraic_immunity-1.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c7a27bcc49b8fb2dadb604a92e9c7da8fcc8fded057a6e5a965373c39159fe5d
MD5 897c57260f4df5f47a38c870422a0253
BLAKE2b-256 834bf7f2a4766c6abcbbd91b56635f488d22d37e8efbdb98341bf5e10a9713d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for algebraic_immunity-1.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1350f13902ec203bbca75f94a6a5227d008c5be74764666bac6bbd647b944346
MD5 7f8497f60722d3d48a97f962b7be5968
BLAKE2b-256 28b331ac1d6815e6ed3cfa810f283b713aed6ff230f1b572b8f8d532fe13cbb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for algebraic_immunity-1.1.0-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 86ec94e8a890238fe9df1adba98ddd0e392d0b078312194bab98fb11031cb93b
MD5 e7bad441a28dac44eff67c8853fd171e
BLAKE2b-256 819101f8184ee382699305ac37fc8e7627b1d149115245501e0f49223e9c4af4

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