Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consecutive bch.decode calls lead to wrong output #35

Open
Lukas113 opened this issue Apr 17, 2024 · 0 comments
Open

Consecutive bch.decode calls lead to wrong output #35

Lukas113 opened this issue Apr 17, 2024 · 0 comments

Comments

@Lukas113
Copy link

Lukas113 commented Apr 17, 2024

Using bchlib=1.0.0 & python=3.12, I've found that consecutive calls of bch.decode of the same bch instance results most likely in wrong outputs. Steps to reproduce:

Consecutive bch.decode calls:

>>> from bchlib import BCH
>>> from bitstring import Bits
>>> bch = BCH(t=16, prim_poly=8219)
>>> data = Bits(b"First").tobitarray()
>>> ecc = bch.encode(data)
>>> data2 = Bits(b"Second").tobitarray()
>>> ecc2 = bch.encode(data2)
>>> print(f"n-errors data: {bch.decode(data, ecc)}")
n-errors data: 0
>>> print(f"n-errors data2: {bch.decode(data2, ecc2)}")
n-errors data2: -1

I also added bch.correct in between the decoding steps in case some cleanup would be done there. However, the result is the same.

Same as above, but without the first bch.decode call:

>>> from bchlib import BCH
>>> from bitstring import Bits
>>> bch = BCH(t=16, prim_poly=8219)
>>> data = Bits(b"First").tobitarray()
>>> ecc = bch.encode(data)
>>> data2 = Bits(b"Second").tobitarray()
>>> ecc2 = bch.encode(data2)
>>> # print(f"n-errors data: {bch.decode(data, ecc)}")
>>> print(f"n-errors data2: {bch.decode(data2, ecc2)}")
n-errors data2: 0

Testing this using bchlib=0.14.0 worked fine as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant