mail[Wesnoth-commits] r52830 - /trunk/src/sha1.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by shadowm2006 on January 31, 2012 - 01:36:
Author: shadowmaster
Date: Tue Jan 31 01:36:56 2012
New Revision: 52830

URL: http://svn.gna.org/viewcvs/wesnoth?rev=52830&view=rev
Log:
Improve SHA1 digest computation correctness (patch from bug #19312)

Modified:
    trunk/src/sha1.cpp

Modified: trunk/src/sha1.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/sha1.cpp?rev=52830&r1=52829&r2=52830&view=diff
==============================================================================
--- trunk/src/sha1.cpp (original)
+++ trunk/src/sha1.cpp Tue Jan 31 01:36:56 2012
@@ -34,7 +34,7 @@
 #include <sstream>
 
 #define sha_rotl(n,x)          ( ((x) << (n)) | ((x) >> (32-(n))) )
-#define sha_ch(x,y,z)          ( ((x) & (y)) | ((!(x)) & (z)) )
+#define sha_ch(x,y,z)          ( ((x) & (y)) | ((~(x)) & (z)) )
 #define sha_parity(x,y,z)      ( (x) ^ (y) ^ (z) )
 #define sha_maj(x,y,z)         ( ((x) & (y)) | ((x) & (z)) | ((y) & (z)) )
 
@@ -68,7 +68,7 @@
                        for (i = 63; i > bytes_left; i--) {
                                block[i]=0; // pad our block with zeros
                        }
-                       if (bytes_left < 60) { // enough space to store the 
length
+                       if (bytes_left < 56) { // enough space to store the 
length
                                // put the length at the end of the block
                                block[60] = ssz >> 24;
 #ifdef _MSC_VER




Related Messages


Powered by MHonArc, Updated Tue Jan 31 05:20:10 2012