Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sz3/pywirehair

Python wrapper for wirehair
https://github.com/sz3/pywirehair

error-correcting-codes fountain-codes

Last synced: about 1 month ago
JSON representation

Python wrapper for wirehair

Awesome Lists containing this project

README

        

## pywirehair

A python wrapper for the [wirehair](https://github.com/catid/wirehair) forward error correction C/C++ library. wirehair is included as a git subtree.

I'll probably put some wheels in pypi sooner or later. In the meantime:

```
python setup.py build
python setup.py install
```

or maybe:
`pip install https://github.com/sz3/pywirehair/archive/master.zip`

## Usage

```
from pywirehair import encoder, decoder

data = b'0123456789' * 10
enc = encoder(data, 40)
a = enc.encode(0)

dec = decoder(len(data), 40)
dec.decode(0, a)

for i in range(2,4): # skip 1 for fun
print(i)
a = enc.encode(i)
print(dec.decode(i, a))
```

decoder.decode() will return `None` if there is more work to do, or the decoded value if all is well. Error cases are not incredibly well handled at the moment, but should explode in predictable and obvious ways.