> I hate to say it; but right now, this would be great!
Whew! 'Cause, even though I've used them for years, I have no idea whatsoever how they work. And even though I usually enjoy the "under the hood" stuff I have absolutely no desire to know.

Personally, in my PB/DOS programs I use a CRC32 function in an OBJ file that I got from a commercial library years ago. I $LINK it to my programs and never worry about how it works any more than I worry about how the COS function works.
I can tell you a couple of things, for the day you decide to figure them out… Generally speaking, there are two types of CRC32 functions. The first type is "table based". They involve a long list of numeric values that the function uses in its calculations. Then there are non-table-based functions. They are 100% algorithm-based - usually a relatively small loop -- and they are usually significantly slower than table-based functions, but they are also much smaller, code-wise. And if you want to understand the concept behind CRCs, non-table-based functions are the ones you want to study.
Second, I discovered a neat trick for determining whether or not a CRC correctly matches a string of bytes. If you calculate the CRC32 for a string, you get a 32-bit (4-byte) CRC string, right? If you add the CRC string to the original string and calculate the CRC of that string, the resulting CRC is always zero, i.e. STRING$(4,0). So you can check something like a file (or a Zmodem block) very easily by calculating the CRC of the string including its CRC (which is presumably the last 4 bytes of the string) and checking for zero.
As far as source code goes, have you searched this BBS? I just did a quick search of All Open Forums for "CRC" and found several complete PowerBASIC functions. If you need help modifying one of those (to return a LONG instead of a string, or whatever), let me know.
HTH.
-- Eric
------------------
Perfect Sync: Perfect Sync Development Tools
Email: mailto:[email protected][email protected]</A>
[This message has been edited by Eric Pearson (edited March 09, 2000).]
Leave a comment: