semvec/pypi-packages huggingface dataset:
algebraic-immunity 0.1.0
A Rust-based Python package to compute the algebraic immunity of Boolean functions.
Requires Python: >=3.6

# algebraic_immunity

Rust implementation of the algebraic immunity computation of Boolean functions, based on the paper  
*"Efficient Computation of Algebraic Immunity for Algebraic and Fast Algebraic Attacks"*  
(Armknecht et al., 2006, DOI: https://doi.org/10.1007/11761679_8).

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:

```bash
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:
```bash
python construct_wheel_url.py
```
2. Then install the wheel using:
```bash
pip install <output of the previous command>
```
---

## Usage Example (Python)
```python
from algebraic_immunity import AlgebraicImmunity

truth_table = [0, 1, 1, 1, 1, 0, 0, 1]
n = 3
ai = AlgebraicImmunity.algebraic_immunity(truth_table, n)
print(f"Algebraic immunity: {ai}")
```
rulerunner-sdk 0.3.0
Official Python SDK for RuleRunner API
Requires Python: >=3.8

# RuleRunner Python SDK

Official Python SDK for the RuleRunner API - a compliance-as-a-service platform for blockchain transactions.

## Installation

```bash
pip install rulerunner-sdk
```

## Quick Start

```python
from rulerunner_sdk import RuleRunnerClient

# Initialize the client with your API key
client = RuleRunnerClient(api_key="YOUR_API_KEY")

# Check if a transaction is compliant
result = client.is_compliant(
    from_address="0x7FF9cFad3877F21d41Da833E2F775dB0569eE3D9",
    to_address="0x742d35Cc6634C0532925a3b844Bc454e4438f44f",
    amount="1.0"
)

print(f"Transaction is compliant: {result['is_compliant']}")
print("--------------------------------")
print(result.get("from_entity_details"))
print("--------------------------------")

# Verify a proof locally
if not result['is_compliant'] and result.get('from_address_proof'):
    is_valid = client.verify_proof_locally(
        address="0x7FF9cFad3877F21d41Da833E2F775dB0569eE3D9",
        proof=result.get("from_address_proof"),
        root=result['merkle_root']
    )
    print(f"Local proof verification: {is_valid}")
```

## Features

- Transaction compliance checking
- Local proof verification
- Health check endpoint
- API key management

## API Reference

### RuleRunnerClient

```python
client = RuleRunnerClient(
    api_key: str,
    base_url: str = "https://api.rulerunner.com"  # Optional custom base URL
)
```

### Methods

#### is_compliant

Check if a transaction is compliant with sanctions lists.

```python
result = client.is_compliant(
    from_address: str,
    to_address: str,
    amount: str
)
```

#### verify_proof_locally

Verify a Merkle proof locally without making an API call.

```python
is_valid = client.verify_proof_locally(
    address: str,
    proof: List[Dict[str, Any]],
    root: str
)
```

#### health_check

Check the health status of the API.

```python
status = client.health_check()
```

## Error Handling

The SDK raises custom exceptions for different error cases:

- `RuleRunnerAPIError`: API-level errors (4xx, 5xx)
- `RuleRunnerConnectionError`: Network/connection issues
- `RuleRunnerProofVerificationError`: Invalid proof data

## License

MIT License