algebraic_immunity
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:
- Run the following script to determine the correct wheel for your platform:
python construct_wheel_url.py
- 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}")
Metadata
Release files for algebraic-immunity 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| algebraic_immunity-1.2.1.tar.gz | 7.9 kB | With provenance | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| algebraic_immunity-1.2.1-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details |
| algebraic_immunity-1.2.1-cp310-cp310-win32.whl | CPython 3.10 | CPython 3.10 | Windows x86-32 | Details |
| algebraic_immunity-1.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.17+ x86-64 | Details |
| algebraic_immunity-1.2.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.17+ ARM64 | Details |
| algebraic_immunity-1.2.1-cp310-cp310-macosx_11_0_arm64.whl | CPython 3.10 | CPython 3.10 | macOS 11.0+ ARM64 | Details |
| algebraic_immunity-1.2.1-cp310-cp310-macosx_10_12_x86_64.whl | CPython 3.10 | CPython 3.10 | macOS 10.12+ x86-64 | Details |
Total release size: 1.7 MB
Release files / algebraic_immunity-1.2.1.tar.gz
| Download URL | algebraic_immunity-1.2.1.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2df53abb847e2d86839ea2af6198aeb7c4291f1044574dcbd2c03690d76ce18f
|
|
BLAKE2b-256 checksum How to use checksums |
b2f855c22c6f6c453a9e365c2c03db766199de1b75609bc50fd3ba9ea8060eaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.
Transparency logRelease files / algebraic_immunity-1.2.1-cp310-cp310-win_amd64.whl
| Download URL | algebraic_immunity-1.2.1-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 189.5 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
193fa3b08fb9397873b7feee9d74db0a08c29b8c11e83d41b69f8d246ca2a949
|
|
BLAKE2b-256 checksum How to use checksums |
100c1acf81c9b4ce23e3e4c316ea460d0040f8c57ea4ccf508b1fdf342ee280a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.
Transparency logRelease files / algebraic_immunity-1.2.1-cp310-cp310-win32.whl
| Download URL | algebraic_immunity-1.2.1-cp310-cp310-win32.whl |
|---|---|
| Size | 177.0 kB |
| Tags | CPython 3.10 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
cbfc8f89c73ba9e6e8fcc9f8a002c0c40c4cf0440ec46c605359d56a2f232046
|
|
BLAKE2b-256 checksum How to use checksums |
a23d998190ebc2d430a0f83f3345c38bf252f7da2efc657d9b93cffc9e4de0d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.
Transparency logRelease files / algebraic_immunity-1.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | algebraic_immunity-1.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 351.1 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
e50b8998223f1d8ab22c3711ccdadbdd9a9298f4c4f048d741bf7f18130d4479
|
|
BLAKE2b-256 checksum How to use checksums |
5bc8d98a305fb3ec604153175353034284be8fd405f93d06bbcc9214c30d8735
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.
Transparency logRelease files / algebraic_immunity-1.2.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | algebraic_immunity-1.2.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 348.7 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
a2bf9cd9fac6de23269e1f5d3f60f09481a2fa448287055f4a534acc770c8494
|
|
BLAKE2b-256 checksum How to use checksums |
8df70a7ef429b7bbc5dce357f5a76823cdfdb833ef8b39eb4492acfea3b51e8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.
Transparency logRelease files / algebraic_immunity-1.2.1-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | algebraic_immunity-1.2.1-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 304.4 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a184b453e7fff1b900f879aa7f284ec8070982e5538b4a3bd50202f10e0ffaa5
|
|
BLAKE2b-256 checksum How to use checksums |
bcf78408994cbb30fee7de5882d9b4cccca6568e4bc072dcdec961973859b6b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.
Transparency logRelease files / algebraic_immunity-1.2.1-cp310-cp310-macosx_10_12_x86_64.whl
| Download URL | algebraic_immunity-1.2.1-cp310-cp310-macosx_10_12_x86_64.whl |
|---|---|
| Size | 306.9 kB |
| Tags | CPython 3.10 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
785240740241cb2e0bc8b9d7e4c118ec6923f4d595d03e30b855dc84b572be43
|
|
BLAKE2b-256 checksum How to use checksums |
2b2129dd00a07d8c093a70d53b08078be078435acbe970d5dad5112d07271000
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.
Transparency logSecurity for algebraic-immunity 1.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 7 files in this release have been uploaded with provenance metadata.
Attestation for algebraic_immunity-1.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.