@@ -18,13 +18,13 @@ #import "OFExceptions.h" #import "OFMacros.h" int _OFHashing_reference; -/******* - * MD5 * - *******/ +/* + * MD5 + */ /* The four MD5 core functions - F1 is optimized somewhat */ #define F1(x, y, z) (z ^ (x & (y ^ z))) #define F2(x, y, z) F1(z, x, y) #define F3(x, y, z) (x ^ y ^ z) @@ -246,13 +246,13 @@ #undef F2 #undef F3 #undef F4 #undef MD5STEP -/******** - * SHA1 * - ********/ +/* + * SHA1 + */ /* blk0() and blk() perform the initial expand. */ #ifndef OF_BIG_ENDIAN #define blk0(i) \ (block->l[i] = (OF_ROL(block->l[i], 24) & 0xFF00FF00) | \ @@ -408,13 +408,15 @@ while ((count & 504) != 448) sha1_update(state, &count, buffer, "\0", 1); /* Should cause a sha1_transform() */ sha1_update(state, &count, buffer, finalcount, 8); - for (i = 0; i < SHA1_DIGEST_SIZE; i++) + for (i = 0; i < OF_SHA1_DIGEST_SIZE; i++) digest[i] = (char)((state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255); + + calculated = YES; return digest; } @end