security code number generation

Peter Brigham MD pmbrig at gmail.com
Sat Apr 2 12:51:47 EDT 2011


For anyone who might have the need, I have a handler I use to generate  
a security code, in my case for printed prescriptions. It takes the  
name of the patient, the date of the prescription, the medication and  
med strength and hashes all that to produce a ten-digit alphanumeric  
string (using 0-9, a-z, A-Z). If there is any question about the  
validity of the prescription I can retrieve the correct code from the  
rx entry in my database with a mouseclick (actually recalculating the  
code from the stored rx data) and confirm it with the pharmacy. This  
has proved useful on two occasions when a pt was playing fast and  
loose with his prescriptions.

The algorithm is fast in LC, sufficiently obscure that I'm pretty sure  
it would be hard to hack -- though of course few things are  
bulletproof in encryption if someone wants to try hard enough -- and  
discontinuous in the sense that similar inputs do not generate similar  
outputs, eg, change one character in the input and the code number is  
completely different. The probability of coming up with the correct  
security number by chance alone is 1 in 10^15 (a million billion to  
1). It could be adapted to any number of purposes. I am not posting  
the handler here, since it would be unwise to let it be archived and  
available, eg, with a Nabble search, but if anyone is interested, let  
me know and I'll share it.

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig





More information about the use-livecode mailing list