tomerfiliba-org / reedsolomon

⏳🛡 Pythonic universal errors-and-erasures Reed-Solomon codec to protect your data from errors and bitrot. Includes a future-proof zero-dependencies pure-python implementation 🔮 and an optional speed-optimized Cython/C extension 🚀
http://pypi.python.org/pypi/reedsolo
Other
352 stars 86 forks source link

Enable multiple reedsolo at the same time #26

Closed Sec42 closed 3 years ago

Sec42 commented 3 years ago

I have code that needs to verify two different reedsolo checksums at different times.

one with c_exp=8, the second one with c_exp=6.

My current solution is to copy reedsolo.py to reedsolo6.py and import both reedsolo and reedsolo6 so i can have two instances.

It would be nice if this were supported out of the box :-)

lrq3000 commented 3 years ago

Are you instanciating two RSCodec objects or are you accessing the internal functions directly?

If you use the RSCodec object, it should automatically switch the precomputed tables to match the field you initiated the RSCodec with.

Le ven. 11 sept. 2020 à 19:32, Sec notifications@github.com a écrit :

I have code that needs to verify two different reedsolo checksums at different times.

one with c_exp=8, the second one with c_exp=6.

My current solution is to copy reedsolo.py to reedsolo6.py and import both reedsolo and reedsolo6 so i can have two instances.

It would be nice if this were supported out of the box :-)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tomerfiliba/reedsolomon/issues/26, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIRFXTNCMJ6RVH2X3WHEJTSFJNL7ANCNFSM4RH6VEIQ .

Sec42 commented 3 years ago

You are right. I was using an old version of reedsolo.py and doing things via reedsolo.init_tables and then reedsolo.rs_correct_msg / reedsolo.rs_encode_msg at the moment. partly because I had known erasures & needed to know how many errors were corrected.

Taking a second look at the documentation it seems that it should work via the object interface. Will try & report back.

Thanks

Sec42 commented 3 years ago

I managed to do it with the RSCodec class interface. Sorry for the noise.