UNB ECE4253 Digital Communications
Department of Electrical and Computer Engineering - University of New Brunswick, Fredericton, NB, Canada

Polynomial Code Generator Tool

Given a generator polynomial G(x) of degree p and a binary input data size k, this online tool creates and displays a generator matrix G, a check matrix H, and a demonstration of the resulting systematic codewords for this (n,k) code, where n=p+k. The nature of G(x) and the value of k will determine the utility of the codewords in a error control scheme.

The mathematics of error control can be based on either a matrix or a polynomial approach. This page shows how any polynomial G(x) may be used to define an equivalent check matrix and generator matrix. Conversely, it is not always possible to find a polynomial G(x) corresponding to an arbitary generator matrix.

The generator polynomial G(x) can be up to degree p=36, and the input data size is limited to k=36 bits.


Polynomial G(x)

G(x) = x16+x12+x5+1

(10001000000100001)


Sample (52,36) Codewords  (not cyclic)

DATA = 00 : 0000000000000000000000000000000000000000000000000000
DATA = 01 : 0000000000000000000000000000000000010001000000100001
DATA = 02 : 0000000000000000000000000000000000100010000001000010
DATA = 03 : 0000000000000000000000000000000000110011000001100011
DATA = 04 : 0000000000000000000000000000000001000100000010000100
DATA = 05 : 0000000000000000000000000000000001010101000010100101
DATA = 06 : 0000000000000000000000000000000001100110000011000110
DATA = 07 : 0000000000000000000000000000000001110111000011100111
DATA = 08 : 0000000000000000000000000000000010001000000100001000
DATA = 09 : 0000000000000000000000000000000010011001000100101001
DATA = 10 : 0000000000000000000000000000000010101010000101001010
DATA = 11 : 0000000000000000000000000000000010111011000101101011
DATA = 12 : 0000000000000000000000000000000011001100000110001100
DATA = 13 : 0000000000000000000000000000000011011101000110101101
DATA = 14 : 0000000000000000000000000000000011101110000111001110
DATA = 15 : 0000000000000000000000000000000011111111000111101111
DATA = 16 : 0000000000000000000000000000000100000001001000110001
DATA = 17 : 0000000000000000000000000000000100010000001000010000
DATA = 18 : 0000000000000000000000000000000100100011001001110011
DATA = 19 : 0000000000000000000000000000000100110010001001010010
DATA = 20 : 0000000000000000000000000000000101000101001010110101
DATA = 21 : 0000000000000000000000000000000101010100001010010100
DATA = 22 : 0000000000000000000000000000000101100111001011110111
DATA = 23 : 0000000000000000000000000000000101110110001011010110
DATA = 24 : 0000000000000000000000000000000110001001001100111001
DATA = 25 : 0000000000000000000000000000000110011000001100011000
DATA = 26 : 0000000000000000000000000000000110101011001101111011
DATA = 27 : 0000000000000000000000000000000110111010001101011010
DATA = 28 : 0000000000000000000000000000000111001101001110111101
DATA = 29 : 0000000000000000000000000000000111011100001110011100
DATA = 30 : 0000000000000000000000000000000111101111001111111111
DATA = 31 : 0000000000000000000000000000000111111110001111011110
DATA = 32 : 0000000000000000000000000000001000000010010001100010
DATA = 33 : 0000000000000000000000000000001000010011010001000011
DATA = 34 : 0000000000000000000000000000001000100000010000100000
DATA = 35 : 0000000000000000000000000000001000110001010000000001
DATA = 36 : 0000000000000000000000000000001001000110010011100110
DATA = 37 : 0000000000000000000000000000001001010111010011000111
DATA = 38 : 0000000000000000000000000000001001100100010010100100
DATA = 39 : 0000000000000000000000000000001001110101010010000101
DATA = 40 : 0000000000000000000000000000001010001010010101101010
DATA = 41 : 0000000000000000000000000000001010011011010101001011
DATA = 42 : 0000000000000000000000000000001010101000010100101000
DATA = 43 : 0000000000000000000000000000001010111001010100001001
DATA = 44 : 0000000000000000000000000000001011001110010111101110
DATA = 45 : 0000000000000000000000000000001011011111010111001111
DATA = 46 : 0000000000000000000000000000001011101100010110101100
DATA = 47 : 0000000000000000000000000000001011111101010110001101
DATA = 48 : 0000000000000000000000000000001100000011011001010011
DATA = 49 : 0000000000000000000000000000001100010010011001110010
DATA = 50 : 0000000000000000000000000000001100100001011000010001
DATA = 51 : 0000000000000000000000000000001100110000011000110000
DATA = 52 : 0000000000000000000000000000001101000111011011010111
DATA = 53 : 0000000000000000000000000000001101010110011011110110
DATA = 54 : 0000000000000000000000000000001101100101011010010101
DATA = 55 : 0000000000000000000000000000001101110100011010110100
DATA = 56 : 0000000000000000000000000000001110001011011101011011
DATA = 57 : 0000000000000000000000000000001110011010011101111010
DATA = 58 : 0000000000000000000000000000001110101001011100011001
DATA = 59 : 0000000000000000000000000000001110111000011100111000
DATA = 60 : 0000000000000000000000000000001111001111011111011111
DATA = 61 : 0000000000000000000000000000001111011110011111111110
DATA = 62 : 0000000000000000000000000000001111101101011110011101
DATA = 63 : 0000000000000000000000000000001111111100011110111100
← less


Distance Analysis

This sample subset of 52-bit codewords has a minimum distance D=4, correcting up to t=1 error.

 00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
00--040408040808120408081208121216060410081008141210081412141218160608040610120810101208101416121410100808141412121414121218181616
0104--0804080412080804120812081612040608100810121408101214121416180806060412101008121010081614141210100808141412121414121218181616
020408--04081204080812040812160812100806041412100814121008181614120406060808101012081010121214141608081010121214141212141416161818
03080404--120808041208080416121208081004061214081012140810161812140604080610081210100812101412161408081010121214141212141416161818
0404080812--0404080812121604080812100814120604100814121816100814121012081006080406141612141012081014141212101008081818161614141212
050804120804--08041208161208041208081012140406081012141618081012141210100808060604161414121210100814141212101008081818161614141212
06081204080408--041216081208120408141210081008060418161412141210080810101204060608121414160810101212121414080810101616181812121414
0712080804080404--1612120812080804121408100810040616181214121408101008121006040806141216141008121012121414080810101616181812121414
080408081208121216--04040804080812100814121412181606041008100814121012081014161214060804061012081014141212181816161010080814141212
09080412081208161204--080408041208081012141214161804060810081012141210100816141412080606041210100814141212181816161010080814141212
1008120408121608120408--0408120408141210081816141210080604141210080810101212141416040606080810101212121414161618180808101012121414
111208080416121208080404--12080804121408101618121408100406121408101008121014121614060408061008121012121414161618180808101012121414
12081212160408081204080812--040408141218161008141210081412060410081416121410120810101208100608040618181616141412121414121210100808
1312081612080412080804120804--0804121416180810121408101214040608101614141212101008121010080806060418181616141412121414121210100808
141216081208120408081204080408--04181614121412100814121008100806041214141608101012081010120406060816161818121214141212141408081010
15161212081208080412080804080404--161812141214081012140810081004061412161410081210100812100604080616161818121214141212141408081010
1606041008100814121008141214121816--0404080408081204080812081212161010080814141212141412121818161606080406101208101012081014161214
170406081008101214081012141214161804--08040804120808041208120816121010080814141212141412121818161608060604121010081210100816141412
18100806041412100814121008181614120408--040812040808120408121608120808101012121414121214141616181804060608081010120810101212141416
1908100406121408101214081016181214080404--1208080412080804161212080808101012121414121214141616181806040806100812101008121014121614
201008141206041008141218161008141204080812--04040808121216040808121414121210100808181816161414121210120810060804061416121410120810
21081012140406081012141618081012140804120804--080412081612080412081414121210100808181816161414121212101008080606041614141212101008
2214121008100806041816141214121008081204080408--0412160812081204081212141408081010161618181212141408101012040606081214141608101012
231214081008100406161812141214081012080804080404--16121208120808041212141408081010161618181212141410081210060408061412161410081210
24100814121412181606041008100814120408081208121216--040408040808121414121218181616101008081414121210120810141612140608040610120810
2508101214121416180406081008101214080412081208161204--0804080412081414121218181616101008081414121212101008161414120806060412101008
261412100818161412100806041412100808120408121608120408--04081204081212141416161818080810101212141408101012121414160406060808101012
27121408101618121408100406121408101208080416121208080404--120808041212141416161818080810101212141410081210141216140604080610081210
2814121816100814121008141206041008081212160408081204080812--0404081818161614141212141412121010080814161214101208101012081006080406
291214161808101214081012140406081012081612080412080804120804--08041818161614141212141412121010080816141412121010081210100808060604
30181614121412100814121008100806041216081208120408081204080408--041616181812121414121214140808101012141416081010120810101204060608
3116181214121408101214081008100406161212081208080412080804080404--1616181812121414121214140808101014121614100812101008121006040806
320608040610120810101208101416121410100808141412121414121218181616--04040804080812040808120812121606041008100814121008141214121816
33080606041210100812101008161414121010080814141212141412121818161604--080408041208080412081208161204060810081012140810121412141618
3404060608081010120810101212141416080810101212141412121414161618180408--0408120408081204081216081210080604141210081412100818161412
350604080610081210100812101412161408081010121214141212141416161818080404--12080804120808041612120808100406121408101214081016181214
36101208100608040614161214101208101414121210100808181816161414121204080812--040408081212160408081210081412060410081412181610081412
3712101008080606041614141212101008141412121010080818181616141412120804120804--0804120816120804120808101214040608101214161808101214
380810101204060608121414160810101212121414080810101616181812121414081204080408--04121608120812040814121008100806041816141214121008
39100812100604080614121614100812101212141408081010161618181212141412080804080404--161212081208080412140810081004061618121412140810
4010120810141612140608040610120810141412121818161610100808141412120408081208121216--0404080408081210081412141218160604100810081412
411210100816141412080606041210100814141212181816161010080814141212080412081208161204--08040804120808101214121416180406081008101214
42081010121214141604060608081010121212141416161818080810101212141408120408121608120408--040812040814121008181614121008060414121008
4310081210141216140604080610081210121214141616181808081010121214141208080416121208080404--1208080412140810161812140810040612140810
441416121410120810101208100608040618181616141412121414121210100808081212160408081204080812--04040814121816100814121008141206041008
45161414121210100812101008080606041818161614141212141412121010080812081612080412080804120804--080412141618081012140810121404060810
4612141416081010120810101204060608161618181212141412121414080810101216081208120408081204080408--0418161412141210081412100810080604
471412161410081210100812100604080616161818121214141212141408081010161212081208080412080804080404--16181214121408101214081008100406
48101008081414121214141212181816160608040610120810101208101416121406041008100814121008141214121816--040408040808120408081208121216
4910100808141412121414121218181616080606041210100812101008161414120406081008101214081012141214161804--0804080412080804120812081612
500808101012121414121214141616181804060608081010120810101212141416100806041412100814121008181614120408--04081204080812040812160812
51080810101212141412121414161618180604080610081210100812101412161408100406121408101214081016181214080404--120808041208080416121208
5214141212101008081818161614141212101208100608040614161214101208101008141206041008141218161008141204080812--0404080812121604080812
531414121210100808181816161414121212101008080606041614141212101008081012140406081012141618081012140804120804--08041208161208041208
54121214140808101016161818121214140810101204060608121414160810101214121008100806041816141214121008081204080408--041216081208120408
5512121414080810101616181812121414100812100604080614121614100812101214081008100406161812141214081012080804080404--1612120812080804
561414121218181616101008081414121210120810141612140608040610120810100814121412181606041008100814120408081208121216--04040804080812
57141412121818161610100808141412121210100816141412080606041210100808101214121416180406081008101214080412081208161204--080408041208
5812121414161618180808101012121414081010121214141604060608081010121412100818161412100806041412100808120408121608120408--0408120408
591212141416161818080810101212141410081210141216140604080610081210121408101618121408100406121408101208080416121208080404--12080804
60181816161414121214141212101008081416121410120810101208100608040614121816100814121008141206041008081212160408081204080812--040408
6118181616141412121414121210100808161414121210100812101008080606041214161808101214081012140406081012081612080412080804120804--0804
621616181812121414121214140808101012141416081010120810101204060608181614121412100814121008100806041216081208120408081204080408--04
63161618181212141412121414080810101412161410081210100812100604080616181214121408101214081008100406161212081208080412080804080404--

This sampling of 64 codewords is not necessarily indicative of the error control performance of all 236 = 68719476736 possible codewords.



Specify a new polynomial or a different number of data bits.

Model M20J GENERATOR POLYNOMIAL TOOL
Data Bits k =   G(x):

Discussion Codewords Generator Format
G = [Ik|P]
G = [P|Ik]
MATLAB Matrices

Examples

  1. (8,7) Simple Parity Bit (D=2) no error correction

  2. (7,4) Hamming Code (D=3) single bit error correction

  3. (15,11) Hamming Code (D=3) single bit error correction

  4. (15,10) Extended Hamming Code (D=4) single bit error correction

  5. (31,21) BCH Code (D=5) double bit error correction (notes)

  6. (15,5) BCH Code (D=7) triple bit error correction (notes)

  7. (23,12,7) Binary Golay Code (D=7) triple bit error correction

  8. (35,27) Fire Code specialized 3-bit burst error correction

  9. 16-bit CRC (CCITT) commonly used for error detection (notes)


2025-07-14 21:27:32 ADT
Last Updated: 2015-02-06
Richard Tervo [ tervo@unb.ca ] Back to the course homepage...