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
358 stars 86 forks source link

Have some issues with decoding #33

Closed Pooshkis closed 1 year ago

Pooshkis commented 3 years ago

I'm trying this library with error correcting on network sent messages (between two VMs), but something is wrong. When network connection is perfect and there's no packet loss encoding and decoding works perfectly, but when I'm simulating packet loss even with 4 or 5 errors I get error message:

File "/usr/local/lib/python3.8/dist-packages/reedsolo.py", line 924, in decode
    rmes, recc, errata_pos = rs_correct_msg(chunk, nsym, fcr=self.fcr, generator=self.generator, erase_pos=e_pos, only_erasures=only_erasures)
File "/usr/local/lib/python3.8/dist-packages/reedsolo.py", line 745, in rs_correct_msg
    err_loc = rs_find_error_locator(fsynd, nsym, erase_count=len(erase_pos))
File "/usr/local/lib/python3.8/dist-packages/reedsolo.py", line 658, in rs_find_error_locator
    raise ReedSolomonError("Too many errors to correct")

I'm working with ECC=13 and I even track errors and their positions which I enter in decoding and still.. Any ideas? EDIT: Got this:

Message sent: bytearray(b'123456rx\x15\xa5\x81\x88\xab\xd5\x0c\xf1E\xbc\xce')

Message received:
[14]
bytearray(b'123456'), bytearray(b'123456rx\x15\xa5\x81\x88\xab\xd5\x0c\xf1E\xbc\xce'), bytearray(b'\x12\x11\x10\x0f\x0e\r')

[14] - is error position by my calculation (14th byte)

EDIT No. 2: My bad, sorry :) Kinda works, though, error positions that my code shows and reedsolo show still aren't identical

lrq3000 commented 1 year ago

Please reopen this issue if you still are encountering problems.