@@ -74,13 +74,15 @@ public void setKey(String key) {
7474
7575 private String [] getSubkeys (String originalKey ) {
7676 StringBuilder permutedKey = new StringBuilder (); // Initial permutation of keys via pc1
77- int i , j ;
77+ int i ;
78+ int j ;
7879 for (i = 0 ; i < 56 ; i ++) {
7980 permutedKey .append (originalKey .charAt (PC1 [i ] - 1 ));
8081 }
8182 String [] subKeys = new String [16 ];
8283 String initialPermutedKey = permutedKey .toString ();
83- String C0 = initialPermutedKey .substring (0 , 28 ), D0 = initialPermutedKey .substring (28 );
84+ String C0 = initialPermutedKey .substring (0 , 28 );
85+ String D0 = initialPermutedKey .substring (28 );
8486
8587 // We will now operate on the left and right halves of the permutedKey
8688 for (i = 0 ; i < 16 ; i ++) {
@@ -105,7 +107,8 @@ private String[] getSubkeys(String originalKey) {
105107 }
106108
107109 private String XOR (String a , String b ) {
108- int i , l = a .length ();
110+ int i ;
111+ int l = a .length ();
109112 StringBuilder xor = new StringBuilder ();
110113 for (i = 0 ; i < l ; i ++) {
111114 int firstBit = a .charAt (i ) - 48 ; // 48 is '0' in ascii
@@ -116,7 +119,8 @@ private String XOR(String a, String b) {
116119 }
117120
118121 private String createPaddedString (String s , int desiredLength , char pad ) {
119- int i , l = s .length ();
122+ int i ;
123+ int l = s .length ();
120124 StringBuilder paddedString = new StringBuilder ();
121125 int diff = desiredLength - l ;
122126 for (i = 0 ; i < diff ; i ++) {
@@ -165,7 +169,8 @@ private String encryptBlock(String message, String[] keys) {
165169 for (i = 0 ; i < 64 ; i ++) {
166170 permutedMessage .append (message .charAt (IP [i ] - 1 ));
167171 }
168- String L0 = permutedMessage .substring (0 , 32 ), R0 = permutedMessage .substring (32 );
172+ String L0 = permutedMessage .substring (0 , 32 );
173+ String R0 = permutedMessage .substring (32 );
169174
170175 // Iterate 16 times
171176 for (i = 0 ; i < 16 ; i ++) {
@@ -198,7 +203,9 @@ private String decryptBlock(String message, String[] keys) {
198203 */
199204 public String encrypt (String message ) {
200205 StringBuilder encryptedMessage = new StringBuilder ();
201- int l = message .length (), i , j ;
206+ int l = message .length ();
207+ int i ;
208+ int j ;
202209 if (l % 8 != 0 ) {
203210 int desiredLength = (l / 8 + 1 ) * 8 ;
204211 l = desiredLength ;
@@ -223,7 +230,9 @@ public String encrypt(String message) {
223230 */
224231 public String decrypt (String message ) {
225232 StringBuilder decryptedMessage = new StringBuilder ();
226- int l = message .length (), i , j ;
233+ int l = message .length ();
234+ int i ;
235+ int j ;
227236 if (l % 64 != 0 ) {
228237 throw new IllegalArgumentException ("Encrypted message should be a multiple of 64 characters in length" );
229238 }
0 commit comments