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

Valid primitive polynomials #4

Open
andrzejlisek opened this issue Apr 19, 2021 · 2 comments
Open

Valid primitive polynomials #4

andrzejlisek opened this issue Apr 19, 2021 · 2 comments

Comments

@andrzejlisek
Copy link

andrzejlisek commented Apr 19, 2021

In issue #3 there is provided primitive polynomial for every number of bits between 2 and 30. The polynomial I found using https://www.wolframalpha.com/input/?i=finite+field+of+order+65536 using the first primitive polynomial for each power of 2. I found, that providing invalid polynomial (described as integer positive number) causes infinity loop between lines 317 and 325 of https://github.com/Sonic-The-Hedgehog-LNK1123/ReedSolomon/blob/master/ReedSolomon/GenericGFPoly.cs when Encoding is ran.

I am not familiar with Galois field theory and it is difficult for me. It is possible to reliably test if provided polynomial is valid using your and ZXing code? The performance is not important for me, I will accept the brute-force way. For example, I know that, for 8-bit values all polynomials are between 256 and 511, so it is not problem to generate every value between this and test each value. For 16-bit values there are above 2000 valid primitive polynomials of about 65000 possible polynomials, so the best way is generate the list once and store it.

@Sonic-The-Hedgehog-LNK1123
Copy link
Owner

The easiest (brute-force) way to check if a polynomial is valid is to check if the first ((Galois field size) - 1) values of the generated Galois field are all unique, if they are, the polynomial is valid, if duplicate values are found, the polynomial is invalid.

This check can take a long time for larger fields.

Because this check is a huge performance hit, it's left out in many implementations. In general, the polynomial is specified in whatever specification you're using.

@JessicaMulein
Copy link

JessicaMulein commented Jan 15, 2022

I hate to ask, but are we talking about examining the expTable on the GenericGF object?
If the implementation is simple, could I ask you to show the non-math experts around? :)
I'm looking to generate basically error correction data of original data such that all original data is deleted and the FEC data is divided up into shards, where a required # of shards is needed to reconstruct the data.
It would be nice to be able to has some more mental security as I tinker with this process...

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

3 participants