aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/stream/turing/turing.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/stream/turing/turing.cpp b/src/stream/turing/turing.cpp
index 82e3aa2bb..619ef6682 100644
--- a/src/stream/turing/turing.cpp
+++ b/src/stream/turing/turing.cpp
@@ -210,13 +210,26 @@ void Turing::generate()
*/
u32bit Turing::fixedS(u32bit W)
{
- for(size_t i = 0; i != 4; ++i)
- {
- byte B = SBOX[get_byte(i, W)];
- W ^= rotate_left(Q_BOX[B], i*8);
- W &= rotate_right(0x00FFFFFF, i*8);
- W |= B << (24-i*8);
- }
+ byte B = SBOX[get_byte(0, W)];
+ W ^= Q_BOX[B];
+ W &= 0x00FFFFFF;
+ W |= B << 24;
+
+ B = SBOX[get_byte(1, W)];
+ W ^= rotate_left(Q_BOX[B], 8);
+ W &= 0xFF00FFFF;
+ W |= B << 16;
+
+ B = SBOX[get_byte(2, W)];
+ W ^= rotate_left(Q_BOX[B], 16);
+ W &= 0xFFFF00FF;
+ W |= B << 8;
+
+ B = SBOX[get_byte(3, W)];
+ W ^= rotate_left(Q_BOX[B], 24);
+ W &= 0xFFFFFF00;
+ W |= B;
+
return W;
}