Susan, I disagree with "buying" a system as the only "obvious" answer, and if you are really worried about hackers, then using a prebuilt system that has most likely already been cracked won't really help you. But designing a key system that is hard to hack is very difficult in itself. I think that you should decide who you are trying to "keeping out". If it is the novice end user, and the financial loss of the few serious hackers is not something you are worried about, then moving down the road you are currently pursuing is fine. If you are concerned about Overflow, then use a MOD function, say with 1,000,000,000 as the divisor. This keeps you within Int32. Also, (I worked a little with NSA on encryption), you will find that using multipliers and modulo divisors of different bases can produce unique and evenly distributed "random keys". Base 2 and Base 10 are different, but 10 is evenly divisible by 2, so the results are not evenly distributed, thus making it easier to break the code. Base 3 and 7 or 5 and 7 combinations give excellent results without undue CPU processing.
There are a few books on encryption theory. Unfortunately, my books are packed and I don't remember titles/authors. Also, I believe they are out of print anyway (that was over 25-30 years ago). If you are really, really worried about encrypting data, you could do a goggle search on SHA. We use it with one of our partners for internet secure data transfers of medical data. Hope this input helps. Good luck -------------------------------------------------------------------- Gary Gorsline Easy Business Software ========================== End of Message ========================== ----- Original Message ----- From: "kcorey" <[EMAIL PROTECTED]> To: "Palm Developer Forum" <[EMAIL PROTECTED]> Sent: Saturday, February 08, 2003 1:51 AM Subject: Re: Overflow?! > Susan, > > First off, I'd recommend finding one of the pre-built registration > systems out there (jcode on http://www.ardiri.com, PORT on > http://www.cyberport.com/~tangent/palm/port/, etc). > > That aside, when you're doing this kind of thing, you need to follow the > process through step by step. > > I might digress a little, I'm suspicious of the loop that you've got. I > can't prove it, but my intuition is telling me that that loop could > generate duplicate nProductID's for different registration names. > > Anyway, making nSourceID a double is a good first step, but you need to > look at each time it's used and see if you're overflowing. > > In this case, you're multiplying nProductID by that huge number (which > will ake it larger), and stuffing it into an Int32 again, which > truncates the number. > > This number is going to be quite large. I think the size of number a > double will hold is 15 digits (even a long double can only hold 19) An > Int32 could hold 10 digits. Multiplying a double and an Int32 could > easily result in a 25 digit number. Can even a long double hold that > much? > > Let's assume you get abound this by using an arbitrary precision math > package which basically does the math in BCD or in ASCII...once you've > gotten your result, you'll need to convert it to your string format, > cause there won't be a StrXToA for these formats. > > Finally, "StrNCopy(sProductID,ProductID,8);" will only copy the first 8 > characters, and won't even terminate the string for you. You're > guaranteed to truncate the number. > > Instead of trying to get this code to work, I'd suggest you go with a > registration system that's already done all this dirty work for you > (along with making server-based tools so that the key generation can be > done when the customer purchases rather than a few days later). > > -Ken > > On Sat, 2003-02-08 at 04:31, Susan wrote: > > Now I want to calculate the nProductID as following codes: > > > > Int32 nProductID; > > Int32 nSourceID=9093962000; > > Char* sProductID; > > Char* ProductID; > > > > for(i=1;i<=StrLen(sRegName);i++){ > > n=(UInt16)sRegName[i-1]; > > nProductID=n*i+nProductID; > > } > > > > nProductID=nProductID*nSourceID; > > > > StrIToA(ProductID,nProductID); > > > > StrNCopy(sProductID,ProductID,8); > > > > BUT I cant get the exact result. > > > > Does it because of the overflow? > > How to resolve it? > > > > Thanks for any help!!! > > > > Susan > > > > > > > > -- > > For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ > > > > > > > -- > For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
