Browse Source

Tidying up

master
Chris Smith 15 years ago
parent
commit
d1da69a8a5
1 changed files with 4 additions and 7 deletions
  1. 4
    7
      src/com/md87/util/crypto/ArcFourEncrypter.java

+ 4
- 7
src/com/md87/util/crypto/ArcFourEncrypter.java View File

@@ -55,10 +55,9 @@ public class ArcFourEncrypter {
55 55
         int stateindex = 0;
56 56
 
57 57
         for (int i = 0; i < 256; i++) {
58
-            final byte t = ostate[i];
59
-            stateindex = (stateindex + bytes[keyindex] + t) & 0xff;
58
+            stateindex = (stateindex + bytes[keyindex] + ostate[i]) & 0xff;
60 59
             final byte u = ostate[stateindex];
61
-            ostate[stateindex] = (byte) (t & 0xff);
60
+            ostate[stateindex] = (byte) (ostate[i] & 0xff);
62 61
             ostate[i] = (byte) (u & 0xff);
63 62
 
64 63
             keyindex = (keyindex + 1) % bytes.length;
@@ -77,12 +76,10 @@ public class ArcFourEncrypter {
77 76
         int x = 0, y = 0;
78 77
         
79 78
         for (int i = 0; i < bytes.length; i++) {
80
-            byte sx, sy;
81
-
82 79
             x = (x + 1) & 0xff;
83
-            sx = state[x];
80
+            byte sx = state[x];
84 81
             y = (sx + y) & 0xff;
85
-            sy = state[y];
82
+            byte sy = state[y];
86 83
 
87 84
             state[y] = (byte) (sx & 0xff);
88 85
             state[x] = (byte) (sy & 0xff);

Loading…
Cancel
Save