Skip to content

Commit bdb9acf

Browse files
committed
fix bugs in AES.java(TheAlgorithms#765)
1 parent 3b70b8c commit bdb9acf

File tree

3 files changed

+7
-280
lines changed

3 files changed

+7
-280
lines changed

DataStructures/Lists/CircleLinkedList.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public E remove(int pos) {
5252
before = before.next;
5353
}
5454
E saved = iterator.value;
55-
// assigning the next referance to the the element following the element we want to remove... the last element will be assigned to the head.
55+
// assigning the next reference to the the element following the element we want to remove... the last element will be assigned to the head.
5656
before.next = iterator.next;
5757
// scrubbing
5858
iterator.next = null;

DataStructures/Matrix/Matrix.java

-269
This file was deleted.

ciphers/AES.java

+6-10
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
/**
77
* This class is build to demonstrate the application of the AES-algorithm on a
88
* single 128-Bit block of data.
9-
*
10-
* @see khalil2535
9+
*
1110
*/
1211
public class AES {
1312

@@ -202,8 +201,7 @@ public static BigInteger scheduleCore(BigInteger t, int rconCounter) {
202201
String rBytes = t.toString(16);
203202

204203
// Add zero padding
205-
int rBytesLength = rBytes.length();
206-
while (rBytesLength < 8) {
204+
while (rBytes.length() < 8) {
207205
rBytes = "0" + rBytes;
208206
}
209207

@@ -228,8 +226,8 @@ public static BigInteger scheduleCore(BigInteger t, int rconCounter) {
228226
currentByteBits = Integer.toHexString(currentByte);
229227

230228
// Add zero padding
231-
int currentByteBitsLength = currentByteBits.length();
232-
while (currentByteBitsLength < 2) {
229+
230+
while (currentByteBits.length() < 2) {
233231
currentByteBits = '0' + currentByteBits;
234232
}
235233

@@ -304,8 +302,7 @@ public static int[] splitBlockIntoCells(BigInteger block) {
304302
String blockBits = block.toString(2);
305303

306304
// Append leading 0 for full "128-bit" string
307-
int blockBitsLength = blockBits.length();
308-
while (blockBitsLength < 128) {
305+
while (blockBits.length() < 128) {
309306
blockBits = '0' + blockBits;
310307
}
311308

@@ -333,8 +330,7 @@ public static BigInteger mergeCellsIntoBlock(int[] cells) {
333330
String cellBits = Integer.toBinaryString(cells[i]);
334331

335332
// Append leading 0 for full "8-bit" strings
336-
int cellBitsLength = cellBits.length();
337-
while (cellBitsLength < 8) {
333+
while (cellBits.length() < 8) {
338334
cellBits = '0' + cellBits;
339335
}
340336

0 commit comments

Comments
 (0)