cvs-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Cvs-cvs] Changes to ccvs/lib/md5.c


From: Derek Robert Price
Subject: [Cvs-cvs] Changes to ccvs/lib/md5.c
Date: Mon, 19 Sep 2005 12:25:02 -0400

Index: ccvs/lib/md5.c
diff -u ccvs/lib/md5.c:1.10 ccvs/lib/md5.c:1.11
--- ccvs/lib/md5.c:1.10 Mon May 23 17:44:31 2005
+++ ccvs/lib/md5.c      Mon Sep 19 16:24:56 2005
@@ -1,6 +1,6 @@
 /* md5.c - Functions to compute MD5 message digest of files or memory blocks
    according to the definition of MD5 in RFC 1321 from April 1992.
-   Copyright (C) 1995, 1996, 2001, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 2001, 2003, 2004, 2005 Free Software Foundation, 
Inc.
    NOTE: The canonical source of this file is maintained with the GNU C
    Library.  Bugs can be reported to address@hidden
 
@@ -57,10 +57,8 @@
 #endif
 
 #define BLOCKSIZE 4096
-/* Ensure that BLOCKSIZE is a multiple of 64.  */
 #if BLOCKSIZE % 64 != 0
-/* FIXME-someday (soon?): use #error instead of this kludge.  */
-"invalid BLOCKSIZE"
+# error "invalid BLOCKSIZE"
 #endif
 
 /* This array contains the bytes used to pad the buffer to the next
@@ -335,15 +333,22 @@
         {                                                              \
          a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T;             \
          ++words;                                                      \
-         a = rol (a, s);                                               \
+         CYCLIC (a, s);                                                \
          a += b;                                                       \
         }                                                              \
       while (0)
 
+      /* It is unfortunate that C does not provide an operator for
+        cyclic rotation.  Hope the C compiler is smart enough.  */
+#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
+
       /* Before we start, one word to the strange constants.
         They are defined in RFC 1321 as
 
-        T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64, or
+        T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
+
+        Here is an equivalent invocation using Perl:
+
         perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin 
$_))}'
        */
 
@@ -373,7 +378,7 @@
       do                                                               \
        {                                                               \
          a += f (b, c, d) + correct_words[k] + T;                      \
-         a = rol (a, s);                                               \
+         CYCLIC (a, s);                                                \
          a += b;                                                       \
        }                                                               \
       while (0)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]