File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,6 +161,10 @@ static PyMethodDef md5_methods[] = {
161161static PyObject *
162162md5_getattr (md5object * self , char * name )
163163{
164+ if (strcmp (name , "digest_size" ) == 0 ) {
165+ return PyInt_FromLong (16 );
166+ }
167+
164168 return Py_FindMethod (md5_methods , (PyObject * )self , name );
165169}
166170
@@ -264,11 +268,13 @@ static PyMethodDef md5_functions[] = {
264268DL_EXPORT (void )
265269initmd5 (void )
266270{
267- PyObject * m , * d ;
271+ PyObject * m , * d , * i ;
268272
269273 MD5type .ob_type = & PyType_Type ;
270274 m = Py_InitModule3 ("md5" , md5_functions , module_doc );
271275 d = PyModule_GetDict (m );
272276 PyDict_SetItemString (d , "MD5Type" , (PyObject * )& MD5type );
277+ if ( (i = PyInt_FromLong (16 )) != NULL )
278+ PyDict_SetItemString (d , "digest_size" , i );
273279 /* No need to check the error here, the caller will do that */
274280}
Original file line number Diff line number Diff line change 55/* See below for information about the original code this module was
66 based upon. Additional work performed by:
77
8- Andrew Kuchling (amk1@bigfoot.com )
8+ Andrew Kuchling (akuchlin@mems-exchange.org )
99 Greg Stein (gstein@lyra.org)
1010*/
1111
@@ -458,8 +458,8 @@ SHA_getattr(PyObject *self, char *name)
458458{
459459 if (strcmp (name , "blocksize" )== 0 )
460460 return PyInt_FromLong (1 );
461- if (strcmp (name , "digestsize" )== 0 )
462- return PyInt_FromLong (20 );
461+ if (strcmp (name , "digest_size" ) == 0 || strcmp ( name , " digestsize" )== 0 )
462+ return PyInt_FromLong (20 );
463463
464464 return Py_FindMethod (SHA_methods , self , name );
465465}
@@ -542,4 +542,5 @@ initsha(void)
542542 functions require an integral number of
543543 blocks */
544544 insint ("digestsize" , 20 );
545+ insint ("digest_size" , 20 );
545546}
You can’t perform that action at this time.
0 commit comments