|
15 | 15 |
|
16 | 16 | /** |
17 | 17 | * The following table stands for log_a(x) and exp_a(x), |
18 | | - * where a is the polynomial(here we use 29, (2^8 +) 2^4 + 2^3 + 2^2 + 1) used to generate a Galois field of 256 elements. |
| 18 | + * where a is the polynomial(here we use 285 (0x11D), 2^8 + 2^4 + 2^3 + 2^2 + 1) used to generate a Galois field of 256 elements. |
19 | 19 | * and x is in [0, 255]. |
20 | 20 | */ |
21 | 21 | static const unsigned char xqc_rs_log_table[256] = { |
@@ -122,6 +122,30 @@ static const unsigned char xqc_rs_exp_table[510] = { |
122 | 122 | 27, 54, 108, -40, -83, 71, -114 |
123 | 123 | }; |
124 | 124 |
|
| 125 | +/** |
| 126 | + * inversion table based on irreducible polynomial 285 (0x11D) where F(x) = x^8 |
| 127 | + * + x^4 + x^3 + x^2 + 1, minimum primitive element α = x = 2. |
| 128 | + */ |
| 129 | +static const unsigned char xqc_galois_inv_table[256] = { |
| 130 | + 0, 1, 142, 244, 71, 167, 122, 186, 173, 157, 221, 152, 61, 170, 93, |
| 131 | + 150, 216, 114, 192, 88, 224, 62, 76, 102, 144, 222, 85, 128, 160, 131, |
| 132 | + 75, 42, 108, 237, 57, 81, 96, 86, 44, 138, 112, 208, 31, 74, 38, |
| 133 | + 139, 51, 110, 72, 137, 111, 46, 164, 195, 64, 94, 80, 34, 207, 169, |
| 134 | + 171, 12, 21, 225, 54, 95, 248, 213, 146, 78, 166, 4, 48, 136, 43, |
| 135 | + 30, 22, 103, 69, 147, 56, 35, 104, 140, 129, 26, 37, 97, 19, 193, |
| 136 | + 203, 99, 151, 14, 55, 65, 36, 87, 202, 91, 185, 196, 23, 77, 82, |
| 137 | + 141, 239, 179, 32, 236, 47, 50, 40, 209, 17, 217, 233, 251, 218, 121, |
| 138 | + 219, 119, 6, 187, 132, 205, 254, 252, 27, 84, 161, 29, 124, 204, 228, |
| 139 | + 176, 73, 49, 39, 45, 83, 105, 2, 245, 24, 223, 68, 79, 155, 188, |
| 140 | + 15, 92, 11, 220, 189, 148, 172, 9, 199, 162, 28, 130, 159, 198, 52, |
| 141 | + 194, 70, 5, 206, 59, 13, 60, 156, 8, 190, 183, 135, 229, 238, 107, |
| 142 | + 235, 242, 191, 175, 197, 100, 7, 123, 149, 154, 174, 182, 18, 89, 165, |
| 143 | + 53, 101, 184, 163, 158, 210, 247, 98, 90, 133, 125, 168, 58, 41, 113, |
| 144 | + 200, 246, 249, 67, 215, 214, 16, 115, 118, 120, 153, 10, 25, 145, 20, |
| 145 | + 63, 230, 240, 134, 177, 226, 241, 250, 116, 243, 180, 109, 33, 178, 106, |
| 146 | + 227, 231, 181, 234, 3, 143, 211, 201, 66, 212, 232, 117, 127, 255, 126, |
| 147 | + 253}; |
| 148 | + |
125 | 149 | unsigned char xqc_galois_multiply(unsigned char a, unsigned char b); |
126 | 150 | unsigned char xqc_galois_exp(unsigned char a, unsigned char n); |
127 | 151 |
|
|
0 commit comments