Jump to content
Server Maintenance This Week. ×

CRC32


jorix

This topic is 3764 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Well, I'm hoping that someone out there knows of a plug-in to perform this, because doing it from scratch is something that would take me quite a while.

I do have a book called Practical Algorithms for Programmers by Andrew Binstock and John Rex. It does contain the algorithm for computing the CRC-32 checksum, as well as the CRC-16 and the CRC-CITT, but the algorithms are in C and involve lookup tables. I'm sure that it could be translated into a FileMaker script using a database instead of a lookup table, or at least AppleScript.

Just to give you an idea, the portion on CRC-32 is part of a chpater on Data Integrity which is 36 pages long. CRC-32 is the fourth or fifth algorithm for this purpose, and it builds on previous algorithms. If this is something you really need, and there is no plug-in to provide it for you, then I would suggest finding this book at the library, or a similar book. You'll have to know at least a little bit of C to figure it out, but perhaps you know of a C programmer who can help with that.

Here's an excerpt from the chapter:

"The 16-bit CRCs presented earlier in this chapter are the classic implementations of the algorithms for 16-bit checksums. The CRC-CITT, for example, is the same CRC found in Xmodem-CRC. However, 16-bit CRCs suffer from one serious drawback: they will not catch situations in which leading 0 bits of a data block are dropped. The explanation is logical. The initial value of the CRC is set to 0. You will note that in the tables used by the 16-bit CRCs the value for a zero byte is also 0. Therefore, a data block consisting of two zeros will have the same CRC as a block consisting of five zero bytes. So, if the five-byte block is sent and only two bytes arrive, the CRC will not detect this error."

This goes on to talk about how to get around this problem, and then gives the C code to produce a lookup table for CRC-32 and then the code to use that lookup table to produce the CRC32 checksum.

So you can see, this isn't trivial, and a simple calculation probably won't do the job, or at least that adds yet another complication to the problem.

But it is an interesting problem. Perhaps if I have enough free time someday, I'll try to tackle it.

Another bit of advice I can try to give if there isn't a plug-in for doing this is to find a piece of separate software that will. If you're on the Mac it wouldn't be difficult to tie FileMaker with this software using AppleScript, perhaps with PreFab Player (which allows the scripting of non-scriptable applications). On Windows you could use something like WinBatch or perhaps QuicKeys to do the same thing.

Chuck

Link to comment
Share on other sites

Jorick,

I'm not familiar with the particular calculation, but one approach for doing recursive calcs is to form the calculation within a setfield command and use a script to redo it until some condition is met.

Also, if your calc is in the form of a script, you can have the script call itself. But, although I have had no difficulties on the occasions I've used this approach, I've been told that it is not without some risk.

Bill Holt

Link to comment
Share on other sites

  • 12 years later...

This topic is 3764 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.