PRIVATE static void sha256_transform(uint32_t *state, const uint32_t *data) { uint32_t W[16]; unsigned j; #ifdef _sha256_UNROLL2 uint32_t a,b,c,d,e,f,g,h; a = state[0]; b = state[1]; c = state[2]; d = state[3]; e = state[4]; f = state[5]; g = state[6]; h = state[7]; #else uint32_t T[8]; for (j = 0; j < 8; j++) T[j] = state[j]; #endif for (j = 0; j < 64; j += 16) { #if defined(_sha256_UNROLL) || defined(_sha256_UNROLL2) RX_8(0); RX_8(8); #else unsigned i; for (i = 0; i < 16; i++) { R(i); } #endif } #ifdef _sha256_UNROLL2 state[0] += a; state[1] += b; state[2] += c; state[3] += d; state[4] += e; state[5] += f; state[6] += g; state[7] += h; #else for (j = 0; j < 8; j++) state[j] += T[j]; #endif /* Wipe variables */ /* memset(W, 0, sizeof(W)); */ /* memset(T, 0, sizeof(T)); */ }
static void Sha256_Transform(uint32_t *state, const uint32_t *data) { uint32_t W[16]; unsigned j; uint32_t T[8]; for (j = 0; j < 8; j++) T[j] = state[j]; for (j = 0; j < 64; j += 16) { RX_8(0); RX_8(8); } for (j = 0; j < 8; j++) state[j] += T[j]; }