DSPRelated.com
Forums

Scrambling numbers with excel

Started by Rune Allnor March 14, 2011
Hi folks.

I am looking into methods for using bar codes to list items.
The hardware has already been taken care of, now it's a
matter of finding the numbers to be encoded into the bar code.

Today the numbers to be encoded is a 3-digit code, the exact
number per item is deteremined by a secretary (that is, no technical
skills except of handling MSOffice) and stored in an excel file.
The bar code requires a 12-digit number.

I don't want to use sequential numbers in the bar code, as
wear and tear of the printed bars might lead to problems if the
bars are equal except in tiny details.

So I am considering some sort of 'scrambler' like the encoders /
encrypters used in digital communications.

I *only* want the encoding bit, as help for the secretary: She types
in the 3-digit item code in her excel sheet as she has always done
in one column; I just add a column in the excel sheet where the
12-digit number for the bar code appears.

Any suggestions? The key here is that it is the secretary who will
use this system, so it needs to be implemented through excel.

Rune
Rune Allnor <allnor@tele.ntnu.no> wrote:
(snip)

> Today the numbers to be encoded is a 3-digit code, the exact > number per item is deteremined by a secretary (that is, no technical > skills except of handling MSOffice) and stored in an excel file. > The bar code requires a 12-digit number.
> I don't want to use sequential numbers in the bar code, as > wear and tear of the printed bars might lead to problems if the > bars are equal except in tiny details.
Well, if you multiply by 1001001001 then you would have four copies of your three digit number, and a simple way to get the number back. That isn't so scrambled, though. If you multiply by a**2+b+1, where a, and b, are different numbers not so much greater than 1000, then the result is more scrambled, but still not so hard to get the number out. There are some complicated redundant codes, though usually for much more than 12 digits. It is usual to put a check digit on barcodes, such that, for example, if you add up the digits the result, modulo 10, has a specific value. There are also more complicated check digits, with weights on the digits, and modulo something other than 10. ISBN uses a modulo 11 check digit, which is sometimes X. -- glen
On Mar 14, 10:11&#4294967295;am, glen herrmannsfeldt <g...@ugcs.caltech.edu>
wrote:
> Rune Allnor <all...@tele.ntnu.no> wrote: > > (snip) > > > Today the numbers to be encoded is a 3-digit code, the exact > > number per item is deteremined by a secretary (that is, no technical > > skills except of handling MSOffice) and stored in an excel file. > > The bar code requires a 12-digit number. > > I don't want to use sequential numbers in the bar code, as > > wear and tear of the printed bars might lead to problems if the > > bars are equal except in tiny details. > > Well, if you multiply by 1001001001 then you would have four > copies of your three digit number, and a simple way to get > the number back. &#4294967295;That isn't so scrambled, though. > > If you multiply by a**2+b+1, where a, and b, are > different numbers not so much greater than 1000, > then the result is more scrambled, but still not so hard to > get the number out.
OK, let's adjust the problem formulation: Only 3 digits are in use *today*, but I don't want to hard-code any specific number of digits (although 4 or 5 digits would probably cover the need for all future). Rune
On Sun, 13 Mar 2011 23:23:03 -0700 (PDT), Rune Allnor
<allnor@tele.ntnu.no> wrote:

>Hi folks. > >I am looking into methods for using bar codes to list items. >The hardware has already been taken care of, now it's a >matter of finding the numbers to be encoded into the bar code. > >Today the numbers to be encoded is a 3-digit code, the exact >number per item is deteremined by a secretary (that is, no technical >skills except of handling MSOffice) and stored in an excel file. >The bar code requires a 12-digit number. > >I don't want to use sequential numbers in the bar code, as >wear and tear of the printed bars might lead to problems if the >bars are equal except in tiny details. > >So I am considering some sort of 'scrambler' like the encoders / >encrypters used in digital communications. > >I *only* want the encoding bit, as help for the secretary: She types >in the 3-digit item code in her excel sheet as she has always done >in one column; I just add a column in the excel sheet where the >12-digit number for the bar code appears. > >Any suggestions? The key here is that it is the secretary who will >use this system, so it needs to be implemented through excel. > >Rune
Hi Rune, Here's a dumb question: have you already looked at Excel's "rand()" function? [-Rick-]

Rune Allnor wrote:

> Hi folks. > > I am looking into methods for using bar codes to list items. > The hardware has already been taken care of, now it's a > matter of finding the numbers to be encoded into the bar code. > > Today the numbers to be encoded is a 3-digit code, the exact > number per item is deteremined by a secretary (that is, no technical > skills except of handling MSOffice) and stored in an excel file. > The bar code requires a 12-digit number. > > I don't want to use sequential numbers in the bar code, as > wear and tear of the printed bars might lead to problems if the > bars are equal except in tiny details. > > So I am considering some sort of 'scrambler' like the encoders / > encrypters used in digital communications. > > I *only* want the encoding bit, as help for the secretary: She types > in the 3-digit item code in her excel sheet as she has always done > in one column; I just add a column in the excel sheet where the > 12-digit number for the bar code appears. > > Any suggestions? The key here is that it is the secretary who will > use this system, so it needs to be implemented through excel.
Check "Feistel network" algorithm. It is simple to compute, it makes for unique forward and reverse mapping, and it could be easily crafted for any size of data. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com

Rune Allnor wrote:

> Hi folks. > > I am looking into methods for using bar codes to list items. > The hardware has already been taken care of, now it's a > matter of finding the numbers to be encoded into the bar code. > > Today the numbers to be encoded is a 3-digit code, the exact > number per item is deteremined by a secretary (that is, no technical > skills except of handling MSOffice) and stored in an excel file. > The bar code requires a 12-digit number. > > I don't want to use sequential numbers in the bar code, as > wear and tear of the printed bars might lead to problems if the > bars are equal except in tiny details. > > So I am considering some sort of 'scrambler' like the encoders / > encrypters used in digital communications. > > I *only* want the encoding bit, as help for the secretary: She types > in the 3-digit item code in her excel sheet as she has always done > in one column; I just add a column in the excel sheet where the > 12-digit number for the bar code appears. > > Any suggestions? The key here is that it is the secretary who will > use this system, so it needs to be implemented through excel.
On another thought: let the input 3 digits be an index of a basis function, say, from Walsh-Hadamard transform. Then the output digits could be a binary encoding of this function. So the encoding and decoding operations are simply the forward and the inverse Walsh-Hadamard transforms; this would provide for some error immunity, too. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
On Mon, 14 Mar 2011 04:03:20 -0700, Rick Lyons wrote:

> On Sun, 13 Mar 2011 23:23:03 -0700 (PDT), Rune Allnor > <allnor@tele.ntnu.no> wrote: > >>Hi folks. >> >>I am looking into methods for using bar codes to list items. The >>hardware has already been taken care of, now it's a matter of finding >>the numbers to be encoded into the bar code. >> >>Today the numbers to be encoded is a 3-digit code, the exact number per >>item is deteremined by a secretary (that is, no technical skills except >>of handling MSOffice) and stored in an excel file. The bar code requires >>a 12-digit number. >> >>I don't want to use sequential numbers in the bar code, as wear and tear >>of the printed bars might lead to problems if the bars are equal except >>in tiny details. >> >>So I am considering some sort of 'scrambler' like the encoders / >>encrypters used in digital communications. >> >>I *only* want the encoding bit, as help for the secretary: She types in >>the 3-digit item code in her excel sheet as she has always done in one >>column; I just add a column in the excel sheet where the 12-digit number >>for the bar code appears. >> >>Any suggestions? The key here is that it is the secretary who will use >>this system, so it needs to be implemented through excel. >> >>Rune > > Hi Rune, > Here's a dumb question: have you already looked > at Excel's "rand()" function? > > [-Rick-]
Except that he wants it to be deterministically scrambled, for uniqueness and (presumably) backwards-mapping. -- http://www.wescottdesign.com
On 03/13/2011 11:23 PM, Rune Allnor wrote:
> Hi folks. > > I am looking into methods for using bar codes to list items. > The hardware has already been taken care of, now it's a > matter of finding the numbers to be encoded into the bar code. > > Today the numbers to be encoded is a 3-digit code, the exact > number per item is deteremined by a secretary (that is, no technical > skills except of handling MSOffice) and stored in an excel file. > The bar code requires a 12-digit number. > > I don't want to use sequential numbers in the bar code, as > wear and tear of the printed bars might lead to problems if the > bars are equal except in tiny details. > > So I am considering some sort of 'scrambler' like the encoders / > encrypters used in digital communications. > > I *only* want the encoding bit, as help for the secretary: She types > in the 3-digit item code in her excel sheet as she has always done > in one column; I just add a column in the excel sheet where the > 12-digit number for the bar code appears. > > Any suggestions? The key here is that it is the secretary who will > use this system, so it needs to be implemented through excel.
Yet another suggestion, (which may map to what Vladimir is suggesting) is to calculate the number in binary or some larger base (base 8?) then digit-reverse it, then put it back into base 10. It'll be a one to one mapping so you won't lose uniqueness, small changes in the 3-digit number will lead to large changes in the bar code, and if you ever hand the thing over to a software engineer to maintain it'll be less obscure than something drawn from signal processing. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
On Monday, March 14, 2011 5:11:58 AM UTC-4, glen herrmannsfeldt wrote:

  ...

> It is usual to put a check digit on barcodes, such that, > for example, if you add up the digits the result, modulo 10, > has a specific value. There are also more complicated check > digits, with weights on the digits, and modulo something other > than 10. ISBN uses a modulo 11 check digit, which is sometimes X.
Modulo 11 is easy to compute. Simply take the LSD, subtract the 10s, add the 100s, etc., alternating addition and subtraction until all the digits are accounted for. If the magnitude of the result exceeds 10, repeat. If the final result is negative, add 11. Modulo 9 is also easy to calculate, Do as for 11, but always add. Jerry -- Engineering is the art of making what you want from things you can get.
I think a hashing scheme comes closer to what Rune wants. But Glen's idea of repeating the 3-digit number 4 times obviates the need for a check-bit and provides fairly robust error recovery. It has a beauty that comes of simplicity.

Jerry
-- 
Engineering is the art of making what you want from things you can get.