1

a stupid thing I’m doing in excelSo, 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

  • I'm getting the same results as you, using an eccdemo program I wrote a long time ago. It would help if you use data {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1}. (21 - 0's, 1 - 1). This will result in producing the RS divisor. – rcgldr Jan 26 '22 at 15:12
  • That would be helpful. Unfortunately, it wouldn’t be a valid barcode, so I won’t be able to try it without messing with a barcode generator’s programming. It may come to that, eventually. – Dave PharmD Jan 26 '22 at 20:25
  • I was able to determine the parameters by repeated trials with different parameters, and later found a github repository which matched what I found. With the parameters changed, the Reed Solomon results now match the working barcode data. The changes are noted in my answer. – rcgldr Feb 01 '22 at 11:01

1 Answers1

0

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.

   for(i = 1; i < syn->length; i++){
      for(j = 0; j < rec->length; j++) /* alternatively: j < blockTotalWords */
         syn->b[i] = GfAdd(syn->b[i], GfMultAntilog(rec->b[j], i*j));
   ...

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:

vGenRoots:          02 04 08 10 20 40 80 2d 5a b4 45 8a 39 72 e4 e5 e7 e3
pGenPoly:        01 bc 5a 30 e1 fe 5e 81 6d d5 f1 3d 42 4b bc 27 64 c3 53

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

rcgldr
  • 27,407
  • 3
  • 36
  • 61