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 Distribution

algebraic_immunity-1.2.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distributions

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

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

algebraic_immunity-1.2.1-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.1-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.1-cp310-cp310-macosx_11_0_arm64.whl (304.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

algebraic_immunity-1.2.1-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.1.tar.gz.

File metadata

  • Download URL: algebraic_immunity-1.2.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for algebraic_immunity-1.2.1.tar.gz
Algorithm Hash digest
SHA256 2df53abb847e2d86839ea2af6198aeb7c4291f1044574dcbd2c03690d76ce18f
MD5 64aaa66a8958c00e2ed7e1147cd6e6fc
BLAKE2b-256 b2f855c22c6f6c453a9e365c2c03db766199de1b75609bc50fd3ba9ea8060eaa

See more details on using hashes here.

Provenance

The following attestation bundles were made for algebraic_immunity-1.2.1.tar.gz:

Publisher: CI.yml on LucaBonamino/algebraic_immunity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for algebraic_immunity-1.2.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 193fa3b08fb9397873b7feee9d74db0a08c29b8c11e83d41b69f8d246ca2a949
MD5 e5d9c1632cd01b105f2374c55a51c422
BLAKE2b-256 100c1acf81c9b4ce23e3e4c316ea460d0040f8c57ea4ccf508b1fdf342ee280a

See more details on using hashes here.

Provenance

The following attestation bundles were made for algebraic_immunity-1.2.1-cp310-cp310-win_amd64.whl:

Publisher: CI.yml on LucaBonamino/algebraic_immunity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for algebraic_immunity-1.2.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 cbfc8f89c73ba9e6e8fcc9f8a002c0c40c4cf0440ec46c605359d56a2f232046
MD5 7036798bf87d709e06732fca23e31460
BLAKE2b-256 a23d998190ebc2d430a0f83f3345c38bf252f7da2efc657d9b93cffc9e4de0d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for algebraic_immunity-1.2.1-cp310-cp310-win32.whl:

Publisher: CI.yml on LucaBonamino/algebraic_immunity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for algebraic_immunity-1.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e50b8998223f1d8ab22c3711ccdadbdd9a9298f4c4f048d741bf7f18130d4479
MD5 2136a99423265eed0cc7f4a233fc1bb3
BLAKE2b-256 5bc8d98a305fb3ec604153175353034284be8fd405f93d06bbcc9214c30d8735

See more details on using hashes here.

Provenance

The following attestation bundles were made for algebraic_immunity-1.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on LucaBonamino/algebraic_immunity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for algebraic_immunity-1.2.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a2bf9cd9fac6de23269e1f5d3f60f09481a2fa448287055f4a534acc770c8494
MD5 72174bc7db2a0de00bbcafcd97f98b27
BLAKE2b-256 8df70a7ef429b7bbc5dce357f5a76823cdfdb833ef8b39eb4492acfea3b51e8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for algebraic_immunity-1.2.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on LucaBonamino/algebraic_immunity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for algebraic_immunity-1.2.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a184b453e7fff1b900f879aa7f284ec8070982e5538b4a3bd50202f10e0ffaa5
MD5 24a5d93f527021609a024437b8027005
BLAKE2b-256 bcf78408994cbb30fee7de5882d9b4cccca6568e4bc072dcdec961973859b6b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for algebraic_immunity-1.2.1-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: CI.yml on LucaBonamino/algebraic_immunity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for algebraic_immunity-1.2.1-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 785240740241cb2e0bc8b9d7e4c118ec6923f4d595d03e30b855dc84b572be43
MD5 c3e359aeb3dec805be0b6cb06769c9dc
BLAKE2b-256 2b2129dd00a07d8c093a70d53b08078be078435acbe970d5dad5112d07271000

See more details on using hashes here.

Provenance

The following attestation bundles were made for algebraic_immunity-1.2.1-cp310-cp310-macosx_10_12_x86_64.whl:

Publisher: CI.yml on LucaBonamino/algebraic_immunity

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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