Re: md5 module

michael shiplett (michael.shiplett@umich.edu)
Thu, 28 Oct 1993 12:42:12 -0400

"gvr" == Guido.van.Rossum <Guido.van.Rossum@cwi.nl> writes:

> [Michael Shiplett complains about the md5 module]

gvr> All I can say to my defense is that I didn't write the md5 module.
gvr> Maybe it worked once and now the interface has subtly changed?

I didn't mean to make it sound like complaining so much as things
which seemed not quite right. Being new to python, I wasn't sure if it
was a problem specific to my configuration or the md5 module itself.
Trying to fix the md5 module, I've learned my way around the rsa.com
site & even picked up a couple PEM packages, so it's been time well
spent.

gvr> Anyway, in the next release I'll fix the bugs, change the reference to
gvr> RFC 1321, and include the md5c.c from the RFC in the src directory.
gvr> How does this sound?

Looking at the copyright notice, I think including the RFC files is
okay, provided your docs identify the software as the "RSA Data
Security, Inc. MD5 Message-Digest Algorithm." The files global.h
(rename to md5global.h???) & md5.h should be included as well.
Bundling all the md5 support package seems like a good thing to me.

Have there been any other comments about the extern declarations of
static functions causing problems for linkers? I haven't tested them
on the NeXT yet.

In case you're interested, I've appended my changes for the md5
module.

Now all I need is some time to learn how to use python :)

thanks for the rapid feedback,
michael

*** md5module.distrib Thu Oct 28 08:34:30 1993
--- md5module.c Thu Oct 28 12:29:17 1993
***************
*** 31,36 ****
--- 31,37 ----
#include "allobjects.h"
#include "modsupport.h" /* For getargs() etc. */

+ #include "global.h" /* UINT4 */
#include "md5.h"
typedef struct {
OB_HEAD
***************
*** 128,150 ****
return None;
} /* md5_update() */

static object *
md5_digest(self, args)
md5object *self;
object *args;
{
MD5_CTX mdContext;
! stringobject *strobjp;

if (!getnoarg(args))
return NULL;

/* make a temporary copy, and perform the final */
mdContext = self->md5;
! MD5Final(&mdContext);

! return newsizedstringobject((char *)mdContext.digest, 16);
} /* md5_digest() */

static object *
md5_copy(self, args)
--- 129,155 ----
return None;
} /* md5_update() */

+ #define DIGESTLEN 16 /* this is used twice--walrus@umich.edu */
static object *
md5_digest(self, args)
md5object *self;
object *args;
{
+
MD5_CTX mdContext;
! char aDigest[DIGESTLEN];
!

if (!getnoarg(args))
return NULL;

/* make a temporary copy, and perform the final */
mdContext = self->md5;
! MD5Final(aDigest, &mdContext);

! return newsizedstringobject((char *)aDigest, DIGESTLEN);
} /* md5_digest() */
+ #undef DIGESTLEN

static object *
md5_copy(self, args)
***************
*** 181,188 ****
return findmethod(md5_methods, (object *)self, name);
} /* md5_getattr() */

!
! static typeobject MD5type = {
OB_HEAD_INIT(&Typetype)
0, /*ob_size*/
"md5", /*tp_name*/
--- 186,195 ----
return findmethod(md5_methods, (object *)self, name);
} /* md5_getattr() */

! #ifndef _AIX
! static
! #endif
! typeobject MD5type = {
OB_HEAD_INIT(&Typetype)
0, /*ob_size*/
"md5", /*tp_name*/