Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: donn@u.washington.edu (Donn Cave)
Subject: Re: MD5 implementation
Date: 1996/01/12	[thread overview]
Message-ID: <donn-1201961133420001@xceed.cac.washington.edu> (raw)
In-Reply-To: 4d3usa$gfm@nntpd2.cxo.dec.com

In article <4d3usa$gfm@nntpd2.cxo.dec.com>, spratte@odette.cxo.dec.com
(Michael Spratte) wrote:
...
| I've had no problem with the RFC1321 code running on Digital UNIX.  All
| I did was modify global.h:
| 
| /* UINT4 defines a four byte word */
| #if defined(__osf__) && defined(__alpha)
| typedef unsigned int UINT4;
| #else
| typedef unsigned long int UINT4;
| #endif
| 
| With this modification, the code works identically on ULTRIX, OpenVMS,
| Digital UNIX, and Windows NT.

That's about the same as what I proposed to the author of Python*, and
it turns out there was already a slightly more elegant solution based on
the symbols LONG_BIT and WORD_BIT, in sys/limits.h.  These symbols
evidently are intended to expose the size in bits of "long int" and "int"
respectively.  So the following works not only on the Alpha, but also on
64-bit MIPS hardware etc., as long as there's a sys/limits.h and it has these
symbols, which is true at least on several UNIX platforms.

#include <sys/limits.h>
#if WORD_BIT == 32
typedef unsigned int UINT4;
#else
# if LONG_BIT == 32
typedef unsigned long int UINT4;
# else
what have we here
# endif
#endif

    Donn Cave, University Computing Services, University of Washington
    donn@u.washington.edu

* Python is an interpreted language;  it incorporates this code in its MD5
   support module.  Direct your browser to http://www.python.org.



  parent reply	other threads:[~1996-01-12  5:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-01-11  5:00 MD5 implementation Michael Gsandtner
1996-01-11  5:00 ` Mike Iglesias
1996-01-11  5:00 ` Michael Spratte
1996-01-11  5:00   ` Nick Maclaren
1996-01-12  5:00   ` Donn Cave [this message]
1996-01-12  5:00   ` Michael Gsandtner
1996-01-11  5:00 ` Pierre Vassellerie
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox