March 5th, 2004, 01:36 AM
check msdn msdn.microsoft.com
March 6th, 2004, 05:57 AM
Thank Marc from D. I will think about your idea. And if I still have any questions, I will bother you again.
And thank Mick too.Maybe your answer gives me a great help.
March 6th, 2004, 03:31 PM
You could do some type of algorithm on the original string. Maybe something simple like split the string in half and then add the 2 segments together. Maybe something more involved like split the string in half and get something like a a CRC value from the 2 halves that is 24 digits.
Last edited by TDM; March 6th, 2004 at 03:39 PM.
March 7th, 2004, 12:59 AM
Hi,TDM.I would think about your idea too.
Thanks a lot.
March 7th, 2004, 01:43 AM
Just a small modification to TDM's idea...
Even if you split the string into two halves, each half would still be too big to handle, even using 64-bit maths. You'd need to write something to handle at least 96-bit calculations to avoid losing accuracy.
A small modifcation would be to split the 47 character string into 3, which would allow you to use 64-bit arithmetic. You could then use TDM's suggestion to generate a CRC value for each part.
"A problem well stated is a problem half solved.” - Charles F. Kettering
March 14th, 2004, 09:36 PM
Is the CRC value exclusive?
March 15th, 2004, 02:14 AM
As long as you shorten your string in a mathematical way you will loose data and so uniqueness. As the CRC is much shorter than the original string, it is possible to have several strings that will produce the same CRC.
CRC is typically used to verify that a string has not been changed. So each String has a fix CRC. But a CRC will fit to several strings.
It is IMHO not useful to create just unique numbers.
Situation changes as long as you strip down the redundant data. To do this you have to think about the content of the string. Maybe you have always "0" at multiple, defined positions? In this case you can just cut them out.
... but this is what I stated in an earlier posting.
June 3rd, 2004, 08:55 AM
Use EACH PAIR of characters as an ascii character.
Originally posted by stoneyrh
I am so sorry for my poor expression.
The question should be,
I combine a CpuID-string and the current date-time string as a long string to identify one special user in my database.But the CpuID-string has 32 characters and the current date-time string has 15 characters.So the result string has 47 characters.
It is too long for my application,because I hope the string can be used as a barcode,and the barcode will be printed to a card which is kept by the user.The long barcode is too long to be read by the barcode-reader.So I want to shorten the string.
One example of the string is:
Thanks a lot.
3f = ascii char ?
eb = ascii char ê
f9 = ascii char ù
The characters printed will vary a little depending on the character set used when printing the barcode. However I "think" that if you use code 39 (can print characters) the appropriate code value ie the number from which you create the string, should be the same immaterial of what the printed text looks like.
What this means is that in different languages or codepages in the pc, the visible text may look diferent but the NUMBER should be the read by the scanner as the same numeric value. Obviously you would have to decode this "encoded" number to obtain the numeric value.
There are only two problems that I can see, the code used MUST BE numeric ONLY (decimal or hex) and you cannot use both the FF value AND the 32 value. As both are likely to be PRINTED as a space character (FF is a "hard" space character).
Well I hope this helps somehow. At least it has the potential to reduce your string by half.
Please let me know how you get on and if this does help you.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!