INNER CODE UNIT · C
h
dmitrystu/sboot_stm32 · src/blowfish.c:34
uint32_t h = D.S[0][x >> 24] + D.S[1][(x >> 16) & 0xFF];
return (h ^ D.S[2][(x >> 8) & 0xFF]) + D.S[3][x & 0xFF];
}
void blowfish_encrypt(uint32_t *out, const uint32_t *in){
uint32_t L = in[0];
uint32_t R = in[1];
for (int i = 0; i < rounds; i+=2) {
L ^= D.P[i];
R ^= F(L);
R ^= D.P[i+1];
L ^= F(R);
}
L ^= D.P[16];
R ^= D.P[17];
out[0] = R;
out[1] = L;
}