Sonic-The-Hedgehog-LNK1123 / ReedSolomon

A .NET implementation of the Reed-Solomon algorithm, supporting error, erasure and errata correction
Apache License 2.0
14 stars 1 forks source link

How do I encode one byte or eight bits with new GenericGF(0x25, 32, 0) #1

Closed Git-zyn-Hub closed 3 years ago

Git-zyn-Hub commented 3 years ago

The byte to be encoded is greater than 31 and cannot be found in the array logTable[a]. How do I deal with this situation

Sonic-The-Hedgehog-LNK1123 commented 3 years ago

What are you trying to accomplish?

With a field size of 32, you are limited to 5 bits per symbol, this is why the largest value in the logTable array is 31. So, a byte / 8 bits won't appear in that array, you will need at least 2 symbols, which will be 10 bits in this case, to cover your 8 bits.

Also, encoding a single symbol isn't really useful anyway.

Git-zyn-Hub commented 3 years ago

I just want to use 2 ^ 5 Galois Field, encoding 27 8bits. I didn't quite understand the principle at first. It is impossible to encode 27 8 bits with 2 ^ 5 Galois Field. Now I know that the 2 ^ 5 Galois Field can only encode 27 * 5bits with 4 redundancy. Thank you

Sonic-The-Hedgehog-LNK1123 commented 3 years ago

If you need to encode 27 * 8 bits you must use a 2^8 Galois field. This library supports "shortened" RS codes, meaning you don't need to use the full capacity of a given RS code. So, even though a RS code with a 2^8 field has a capacity of data + redundancy = 255 bytes, you can always use less than that. So, a RS code 27 data bytes and 4 redundancy bytes, using a 2^8 Galois field is possible.