Skip to content

Commit 1d372a6

Browse files
author
gefeili
committed
Refactor in permutation
1 parent 57bcec3 commit 1d372a6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

core/src/main/java/org/bouncycastle/crypto/engines/AsconPermutationFriend.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ public void round(long C)
3333
//long x0x2c = x0 ^ x2;
3434
long x1x2c = x1 ^ x2;
3535

36-
//long t0 = x0 ^ x1x2c ^ x3 ^ (x1 & (x0x4 ^ x2));
37-
long t0 = x0 ^ x2 ^ x3 ^ (x1 & ~(x0x4 ^ x2));
38-
long t1 = x0x4 ^ x2 ^ x3 ^ (x1x2c & (x1 ^ x3));
39-
//long t1 = x0x4 ^ x2 ^ x3 ^ (x1 & ~(x2 | x3));
36+
long t0 = x3 ^ (x1 | x2) ^ x0 ^ (x1 & x0x4);
37+
//long t1 = x0x4 ^ x2 ^ x3 ^ (x1x2c & (x1 ^ x3));
38+
long t1 = x0x4 ^ (x1 | x2 | x3) ^ (x1 & x2 & x3);
4039
long t2 = x1x2c ^ (x4 & (~x3));//x4 ^ (x3 & x4);
4140
//long t3 = x0 ^ x1x2c ^ ((~x0) & (x3 ^ x4));
4241
long t3 = (x0 | (x3 ^ x4)) ^ x1x2c;
43-
long t4 = x1 ^ x3 ^ x4 ^ (x0x4 & x1);
42+
//long t4 = x1 ^ x3 ^ x4 ^ (x0x4 & x1);
43+
long t4 = x3 ^ (x1 | x4) ^ (x0 & x1);
4444
x0 = t0 ^ Longs.rotateRight(t0, 19) ^ Longs.rotateRight(t0, 28);
4545
x1 = t1 ^ Longs.rotateRight(t1, 39) ^ Longs.rotateRight(t1, 61);
4646
x2 = ~(t2 ^ Longs.rotateRight(t2, 1) ^ Longs.rotateRight(t2, 6));

0 commit comments

Comments
 (0)