Thanks, Obscuring the number is not a problem, but I think they want to
be able to read the number off the ticket at the end of the day in
sequential order and I don't see how I can come up with a simple way to
do this.
Frank.
Frank Cazabon
On 10/10/2018 03:48 PM, Richard Kaye wrote:
One way is to come up with a 10 letter "word" with each letter representing a
digit. You then convert the numeric sequence to alpha characters. And to avoid the
pattern being too easily spotted, add one or more random characters to the final string.
It's not the most robust encryption scheme in the world but it should obscure it enough.
Here's a bit of VFP code to do this using the non-dictionary phrase MONKEYSHIP as the
rebus. Pass it the number to encode and optionally .t. as the second parameter to append
a single random character at the end.
**************************************
* Program: MONKEYSHIP.PRG
* Date: 05/07/2007 03:26 PM
* VFP Version: Visual FoxPro 09.00.0000.7423 for Windows
* Notes:
**************************************
FUNCTION MonkeyShip(m.tnStringToEncode AS Number, m.tlRandom AS Boolean)
LOCAL m.lcRetval AS Character
m.lcStringToEncode=ALLTRIM(TRANSFORM(m.tnStringToEncode,[999999999999999]))
LOCAL ARRAY laRebus[10,2]
m.laRebus[1,1]=1
m.laRebus[1,2]=[M]
m.laRebus[2,1]=2
m.laRebus[2,2]=[O]
m.laRebus[3,1]=3
m.laRebus[3,2]=[N]
m.laRebus[4,1]=4
m.laRebus[4,2]=[K]
m.laRebus[5,1]=5
m.laRebus[5,2]=[E]
m.laRebus[6,1]=6
m.laRebus[6,2]=[Y]
m.laRebus[7,1]=7
m.laRebus[7,2]=[S]
m.laRebus[8,1]=8
m.laRebus[8,2]=[H]
m.laRebus[9,1]=9
m.laRebus[9,2]=[I]
m.laRebus[10,1]=0
m.laRebus[10,2]=[P]
m.lcRetval=[]
m.lcChar=[]
FOR m.x=1 TO LEN(ALLTRIM(m.lcStringToEncode))
m.lcChar=m.laRebus[ASCAN(m.laRebus,VAL(SUBSTR(m.lcStringToEncode,x,1)),1,-1,1,8),2]
m.lcRetval=m.lcRetval+m.lcChar
NEXT
IF m.tlRandom
LOCAL m.liCounter AS Integer
PRIVATE m.pcRandomChar
m.pcRandomChar=[ ]
m.liCounter=1
*!* get a bunch of values to work with which will hopefully give at least one
alpha not in monkeyship
DO WHILE NOT ReturnRandom()
m.liCounter=m.liCounter+1
IF m.liCounter=10
EXIT
ENDIF
ENDDO
IF m.liCounter=10 && we went through loop 10 times and could not
get a char back
m.lcRetval=[Q]+m.lcRetval
ELSE
m.lcRetval=m.pcRandomChar+m.lcRetval
ENDIF
ENDIF
RETURN m.lcRetval
ENDFUNC
FUNCTION ReturnRandom
LOCAL m.lcRandomSeed AS Character, m.lIsGood AS Boolean
*!* get a bunch of values to work with which will hopefully give at least one
alpha not in monkeyship
m.lcRandomSeed=SYS(2015)+SYS(2015)+SYS(2015)+SYS(2015)
m.lIsGood=.f.
FOR m.y=LEN(m.lcRandomSeed) TO 2 STEP -1 && don't need to check first
char in sys(2015)
IF ISALPHA(SUBSTR(m.lcRandomSeed,y,1)) AND NOT
UPPER(SUBSTR(m.lcRandomSeed,y,1))$[MONKEYSHIP]
m.pcRandomChar=SUBSTR(m.lcRandomSeed,y,1)
m.lIsGood=.t.
EXIT
ELSE
m.lIsGood=.f.
ENDIF
NEXT
RETURN m.lIsGood
ENDFUNC
--
rk
-----Original Message-----
From: ProfoxTech <[email protected]> On Behalf Of Frank Cazabon
Sent: Wednesday, October 10, 2018 3:25 PM
To: [email protected]
Subject: Numbering Scheme
I have a client who issues tickets in numerical sequence (it's a pawnshop). The
sequence helps them balance things back at the end of the day (read that as
check for stealing) when checking the various parcels received for the tickets
issued (they keep a copy of the ticket issued to their customer and at the end
of the day sort them sequentially and read the numbers off the tickets to
ensure they match the parcels). They are now not wanting the number printed on
the ticket as their competitors may be able to get an idea from the sequential
numbers how much business they are doing (by getting a ticket early in the
morning and then one ate in the afternoon).
So, they have asked me to come up with a solution and I must admit that I am
coming up blank.
Any ideas?
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.