Differences From Artifact [8c6a093adf]:
- File
src/OFMD5Hash.m
— part of check-in
[46af1252a5]
at
2014-09-01 11:08:43
on branch trunk
— Add OFSHA256Hash
Took me some time to figure out the RFC is buggy and SSIG0(t-15) should
be SSIG0(W(t-15))... (user: js, size: 4648) [annotate] [blame] [check-ins using]
To Artifact [38980867ce]:
- File
src/OFMD5Hash.m
— part of check-in
[b29adaf0bb]
at
2014-09-03 18:53:24
on branch trunk
— OFMD5Hash: Optimize by making it more readable
This has more resemblance to the implementation of the other hashes,
while the old method had more resemblance to how the algorithm is
described in the RFC.It turns out that Clang generates better code when re-assigning all
variables to rotate them by one instead of accessing the variables by an
iteration-dependent index. (user: js, size: 4542) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
79 80 81 82 83 84 85 | new[0] = state[0]; new[1] = state[1]; new[2] = state[2]; new[3] = state[3]; byteSwapVectorIfBE(buffer, 16); | | | | | < < < < | | | | > > | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | new[0] = state[0]; new[1] = state[1]; new[2] = state[2]; new[3] = state[3]; byteSwapVectorIfBE(buffer, 16); #define LOOP_BODY(f) \ { \ uint32_t tmp = new[3]; \ tmp = new[3]; \ new[0] += f(new[1], new[2], new[3]) + \ buffer[wordOrder[i]] + table[i]; \ new[3] = new[2]; \ new[2] = new[1]; \ new[1] += OF_ROL(new[0], rotateBits[(i % 4) + (i / 16) * 4]); \ new[0] = tmp;\ } for (; i < 16; i++) LOOP_BODY(F) for (; i < 32; i++) LOOP_BODY(G) for (; i < 48; i++) |
︙ | ︙ |