Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r735:d97e4436b7bd
Date: 2012-07-28 22:19 +0200
http://bitbucket.org/cffi/cffi/changeset/d97e4436b7bd/

Log:    Issue 15. Anyway names with 16 full bytes are a bit overkill, so
        let's settle on 8 full bytes.

diff --git a/cffi/verifier.py b/cffi/verifier.py
--- a/cffi/verifier.py
+++ b/cffi/verifier.py
@@ -1,4 +1,4 @@
-import sys, os, hashlib, imp, shutil
+import sys, os, binascii, imp, shutil
 from . import model, ffiplatform
 from . import __version__
 
@@ -16,9 +16,11 @@
         self.preamble = preamble
         self.kwds = kwds
         #
-        m = hashlib.md5('\x00'.join([sys.version[:3], __version__, preamble] +
-                                    ffi._cdefsources))
-        modulename = '_cffi_%s' % m.hexdigest()
+        key = '\x00'.join([sys.version[:3], __version__, preamble] +
+                          ffi._cdefsources)
+        k1 = hex(binascii.crc32(key[0::2]) & 
0xffffffff).lstrip('0').rstrip('L')
+        k2 = hex(binascii.crc32(key[1::2]) & 
0xffffffff).lstrip('0').rstrip('L')
+        modulename = '_cffi_%s%s' % (k1, k2)
         suffix = _get_so_suffix()
         self.sourcefilename = os.path.join(_TMPDIR, modulename + '.c')
         self.modulefilename = os.path.join(_TMPDIR, modulename + suffix)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to