So, I’m trying to make DataMatrix barcodes in excel and I’m having trouble. This is supposed to read as [FNC1] 010003592671025417220331100155BAG
But it doesn’t. Comparing it to the barcode here: https://barcode.tec-it.com/en/DataMatrix?data=%5CF010003592671025417220331100155BAG
I’ve got the right message bits and padding, but the Reed-Solomon code words don’t match. I verified my math against this site: https://repo.progsbase.com/repoviewer/no.inductive.libraries/ReedSolomon/latest///ComputeReadSolomonCodes/online/
Any ideas what I’m doing wrong? Can anyone direct me to an explanation of how to arrive at the correct Reed-Solomon results manually?
My data:
232 131 130 133 189 156 201 132 184 147 152 133 161 140 131 185 67 66 72 129 223 118 105 78 55 162 108 78 68 83 223 218 160 110 139 190 33 114 0 106
Working barcode’s data:
232 131 130 133 189 156 201 132 184 147 152 133 161 140 131 185 67 66 72 129 223 118 226 84 3 131 93 3 162 119 52 87 211 106 135 113 195 193 11 157
You Reed Solomon code seems to be OK, but the parameters are different. GF(2^8) reducing polynomial is 0x12D (not 0x11D), and the first consecutive root for the generator (dividing) polynomial is 2 (not 1). With these two changes, the Reed Solomon results match the working barcode data.
I found example code at this github repository:
https://github.com/dmtx/libdmtx/blob/master/dmtxreedsol.c
The code uses primitive polynomial 301 => 0x12D, compute syndromes starts at i = 1, which implies the first consecutive root of the generator polynomial is 2^1 = 2.
There is a RsGenPoly() function, but it's optimized and a bit more difficult to follow.
From my old ecc demo program, the roots and the generator polynomial coefficents in hex are:
If interested, I uploaded the source code for my old eccdemo program to my github repository a few years ago. There's a readme file with a brief summary of the program.
https://github.com/jeffareid/eccdemo8