[Python-checkins] CVS: python/dist/src/Modules md5c.c,2.6,2.7

Martin v. L?wis loewis@users.sourceforge.net
2001年9月24日 10:14:43 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv13462
Modified Files:
	md5c.c 
Log Message:
Patch #463421: speed up md5 module with real memcpy/set.
Index: md5c.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/md5c.c,v
retrieving revision 2.6
retrieving revision 2.7
diff -C2 -d -r2.6 -r2.7
*** md5c.c	2000年09月28日 02:54:51	2.6
--- md5c.c	2001年09月24日 17:14:40	2.7
***************
*** 49,54 ****
 static void Encode(unsigned char *, UINT4 *, unsigned int);
 static void Decode(UINT4 *, unsigned char *, unsigned int);
- static void MD5_memcpy(POINTER, POINTER, unsigned int);
- static void MD5_memset(POINTER, int, unsigned int);
 
 static unsigned char PADDING[64] = {
--- 49,52 ----
***************
*** 127,131 ****
 /* Transform as many times as possible. */
 if (inputLen >= partLen) {
! MD5_memcpy((POINTER)&context->buffer[index], (POINTER)input, partLen);
 MD5Transform(context->state, context->buffer);
 
--- 125,129 ----
 /* Transform as many times as possible. */
 if (inputLen >= partLen) {
! memcpy((POINTER)&context->buffer[index], (POINTER)input, partLen);
 MD5Transform(context->state, context->buffer);
 
***************
*** 139,143 ****
 
 /* Buffer remaining input */
! MD5_memcpy((POINTER)&context->buffer[index],
 (POINTER)&input[i], inputLen-i);
 }
--- 137,141 ----
 
 /* Buffer remaining input */
! memcpy((POINTER)&context->buffer[index],
 (POINTER)&input[i], inputLen-i);
 }
***************
*** 167,171 ****
 
 /* Zeroize sensitive information. */
! MD5_memset((POINTER)context, 0, sizeof (*context));
 }
 
--- 165,169 ----
 
 /* Zeroize sensitive information. */
! memset((POINTER)context, 0, sizeof (*context));
 }
 
***************
*** 257,261 ****
 
 /* Zeroize sensitive information. */
! MD5_memset((POINTER)x, 0, sizeof (x));
 }
 
--- 255,259 ----
 
 /* Zeroize sensitive information. */
! memset((POINTER)x, 0, sizeof (x));
 }
 
***************
*** 290,314 ****
 (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
 }
- }
- 
- 
- /* Note: Replace "for loop" with standard memcpy if possible. */
- static void
- MD5_memcpy(POINTER output, POINTER input, unsigned int len)
- {
- unsigned int i;
- 
- for (i = 0; i < len; i++)
- output[i] = input[i];
- }
- 
- 
- /* Note: Replace "for loop" with standard memset if possible. */
- static void
- MD5_memset(POINTER output, int value, unsigned int len)
- {
- unsigned int i;
- 
- for (i = 0; i < len; i++)
- ((char *)output)[i] = (char)value;
 }
--- 288,290 ----

AltStyle によって変換されたページ (->オリジナル) /