Newsgroups: comp.compilers,comp.theory,comp.lang.misc,comp.lang.dylan
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!spdcc!iecc!compilers-sender
From: eb@kaleida.com (Eric Benson)
Subject: Looking for high-quality hashing function for dynamic linker
Message-ID: <95-08-021@comp.compilers>
Keywords: theory, question, comment
Sender: compilers-sender@chico.iecc.com
Organization: Kaleida Labs, Inc.
Date: Fri, 28 Jul 1995 21:48:16 GMT
Approved: compilers@chico.iecc.com
Lines: 36
Xref: glinda.oz.cs.cmu.edu comp.compilers:9192 comp.theory:13233 comp.lang.misc:22445 comp.lang.dylan:4949

I'm implementing a dynamic linker for a programming language similar to
Dylan.  (The language is ScriptX, see http://www.kaleida.com/ for more
information about it.)  It uses a module system that is almost identical
to Dylan's module system.  A module can export variables to publish
interfaces, and it can use other modules to gain access to their published
interfaces.  Modules can be saved from a compilation environment into a
persistent store with the variables defined within them, and later loaded
into a runtime environment.

I'm looking for a way to quickly verify when loading a module that the
modules with interfaces used by it are available in the runtime
environment and that those interfaces are the same as they were in the
compilation environment.  I can do this with guaranteed 100% accuracy by
saving the names of all the variables exported by all the modules used by
the module when saving the module.  This could take a lot of time when
loading, which is of course when I really don't want to take a lot of
time.

Is it feasible to compute a signature consisting of a few (say, less than
ten) 32 bit words and use this for comparison instead of the entire set of
names?  A false positive comparison would probably result in a severe
malfunction so it should be extremely unlikely, say one-in-a-billion or
less.  I can spend a big chunk of CPU time in the compilation environment
to compute this signature if necessary.  I have a 29-bit CRC hash function
already available.  Is this, or some multi-word variant of it, good enough
for my purposes?  If so, does anyone have a larger-than-29-bit CRC
implementation?  Does anyone have any references to relevant research?

--
Eric Benson
eb@kaleida.com
[A good 32 bit hash function should give you a 1 in 4 billion chance of a
false match. -John]
-- 
Send compilers articles to compilers@iecc.com,
meta-mail to compilers-request@iecc.com.
