diff options
author | lloyd <[email protected]> | 2009-10-29 17:34:52 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-10-29 17:34:52 +0000 |
commit | 7462977b8e5eb95a81a6253dc6e6224334ad6ae9 (patch) | |
tree | d14b468f7a04b02635b11bda017cca56259275b5 /src/hash/md5 | |
parent | 5553c5cf54563280a4ffc94baab7b94a83cb0000 (diff) |
Add a new looping load_be / load_le for loading large arrays at once, and
change some of the hash functions to use it as low hanging fruit.
Probably could use further optimization (just unrolls x4 currently), but
merely having it as syntax is good as it allows optimizing many functions
at once (eg using SSE2 to do 4-way byteswaps).
Diffstat (limited to 'src/hash/md5')
-rw-r--r-- | src/hash/md5/md5.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hash/md5/md5.cpp b/src/hash/md5/md5.cpp index 163413bec..8c1e5a8e1 100644 --- a/src/hash/md5/md5.cpp +++ b/src/hash/md5/md5.cpp @@ -64,9 +64,7 @@ void MD5::compress_n(const byte input[], u32bit blocks) for(u32bit i = 0; i != blocks; ++i) { - for(u32bit j = 0; j != 16; ++j) - M[j] = load_le<u32bit>(input, j); - input += HASH_BLOCK_SIZE; + load_le(M.begin(), input, M.size()); FF(A,B,C,D,M[ 0], 7,0xD76AA478); FF(D,A,B,C,M[ 1],12,0xE8C7B756); FF(C,D,A,B,M[ 2],17,0x242070DB); FF(B,C,D,A,M[ 3],22,0xC1BDCEEE); @@ -108,6 +106,8 @@ void MD5::compress_n(const byte input[], u32bit blocks) B = (digest[1] += B); C = (digest[2] += C); D = (digest[3] += D); + + input += HASH_BLOCK_SIZE; } } |