On 9 Jan 2004 at 4:24, Alan Stewart wrote:

> On 9 Jan 2004 at 11:42, Nicholas Clark wrote:
> 
> > On Fri, Jan 09, 2004 at 02:15:59PM +0800, Autrijus Tang wrote:
> > 
> > > Currently we use the mtime for the executable.  MD5 is arguably more
> > > correct, but requires an extra dependency and some recoding in 
> > > mktmpdir.c -- I'd welcome a patch, if you feel that MD5 is the right
> > > thing to do.
> > 
> > Extra dependency on Digest::MD5 ?
> > It's already going to be present in 5.8.x perl, and IIRC ActiveState
> > include various non-core modules with their distribution, so I'd not
> > be surprised if it's also present in ActiveState's 5.6.x based releases.
> > 
> > Nicholas Clark
> 
> It is in ActiveState 5.6.1, but for mktmpdir.c you'll need C code MD5 subroutines. 
> There are a couple of examples around. One I found at:
>   http://www.cr0.net:8040/code/crypto/
> which mentions SHA-1 (also there) as preferred to MD5 because of suspected 
> collisions, 
> discussed elsewhere.
> 
> Alan Stewart
> 

Attached is a version of mktmpdir.c (and a couple new files) that uses sha-1 to create 
a cache directory name instead of mtime. Also included is sha1test.c that prints the 
sha-1 digest of argv[1] that you can compare to the cache dir name.

BTW, Digest::SHA1 is also included with ActiveState.

Alan Stewart

The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any another MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  mktmpdir.zip
     Date:  9 Jan 2004, 7:02
     Size:  6426 bytes.
     Type:  ZIP-archive

Attachment: mktmpdir.zip
Description: Zip archive

Reply via email to