Metadata-Version: 2.4
Name: python-swoosh
Version: 0.1.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Security :: Cryptography
License-File: LICENSE
Summary: Python bindings for the SWOOSH lattice-based NIKE reference implementation
Keywords: cryptography,kem,nike,lattice,swoosh
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# swoosh — Python bindings for Passive-Swoosh

Python bindings for the **Swoosh** practical lattice-based
non-interactive key exchange (Passive-Swoosh construction).

For background see: https://eprint.iacr.org/2023/271.

## Install

```sh
pip install python-swoosh
```

## Usage

```python
from swoosh import keygen, derive_shared_secret

# Party A and Party B each generate a keypair
sk_a, pk_a = keygen(True)    # is_party_a=True
sk_b, pk_b = keygen(False)   # is_party_a=False

# Each side derives the shared secret using (own_pk, other_pk)
ss_a = derive_shared_secret(pk_a, pk_b, sk_a, True)
ss_b = derive_shared_secret(pk_b, pk_a, sk_b, False)

assert ss_a == ss_b  # 32-byte shared secret
```

> **Note:** `derive_shared_secret` takes `(own_pk, other_pk, sk,
> is_party_a)`. Both sides must pass their *own* public key first,
> otherwise the derived secrets will not match.

Key/signature sizes: secret keys and public keys are 221184 bytes each;
shared secrets are 32 bytes.

## API

- `keygen(is_party_a: bool) -> (secret_key: bytes, public_key: bytes)`
- `derive_shared_secret(own_pk: bytes, other_pk: bytes, sk: bytes, is_party_a: bool) -> bytes`

## Building from source

Requires Rust (stable) and `maturin >= 1.0`:

```sh
pip install maturin
maturin develop --release
```

## License

MIT

