Skip to content

Commit 94f2d80

Browse files
committed
Fix PMD violation
1 parent 8e1652a commit 94f2d80

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

  • src/main/java/org/apache/commons/codec/digest

src/main/java/org/apache/commons/codec/digest/Blake3.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
* @since 1.16
7575
*/
7676
public final class Blake3 {
77+
7778
private static final int BLOCK_LEN = 64;
7879
private static final int BLOCK_INTS = BLOCK_LEN / Integer.BYTES;
7980
private static final int KEY_LEN = 32;
@@ -95,6 +96,19 @@ public final class Blake3 {
9596
private static final int DERIVE_KEY_CONTEXT = 1 << 5;
9697
private static final int DERIVE_KEY_MATERIAL = 1 << 6;
9798

99+
/**
100+
* Pre-permuted for all 7 rounds; the second row (2,6,3,...) indicates the base permutation.
101+
*/
102+
private static final byte[][] MSG_SCHEDULE = {
103+
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
104+
{ 2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8 },
105+
{ 3, 4, 10, 12, 13, 2, 7, 14, 6, 5, 9, 0, 11, 15, 8, 1 },
106+
{ 10, 7, 12, 9, 14, 3, 13, 15, 4, 0, 11, 2, 5, 8, 1, 6 },
107+
{ 12, 13, 9, 11, 15, 10, 14, 8, 7, 2, 5, 3, 0, 1, 6, 4 },
108+
{ 9, 14, 11, 5, 8, 12, 15, 1, 13, 3, 0, 10, 2, 6, 4, 7 },
109+
{ 11, 15, 5, 0, 1, 9, 8, 6, 14, 10, 2, 12, 3, 4, 7, 13 }
110+
};
111+
98112
private final EngineState engineState;
99113

100114
private Blake3(final int[] key, final int flags) {
@@ -307,19 +321,6 @@ private static void round(final int[] state, final int[] msg, final byte[] sched
307321
g(state, 3, 4, 9, 14, msg[schedule[14]], msg[schedule[15]]);
308322
}
309323

310-
/**
311-
* Pre-permuted for all 7 rounds; the second row (2,6,3,...) indicates the base permutation.
312-
*/
313-
private static final byte[][] MSG_SCHEDULE = {
314-
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
315-
{ 2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8 },
316-
{ 3, 4, 10, 12, 13, 2, 7, 14, 6, 5, 9, 0, 11, 15, 8, 1 },
317-
{ 10, 7, 12, 9, 14, 3, 13, 15, 4, 0, 11, 2, 5, 8, 1, 6 },
318-
{ 12, 13, 9, 11, 15, 10, 14, 8, 7, 2, 5, 3, 0, 1, 6, 4 },
319-
{ 9, 14, 11, 5, 8, 12, 15, 1, 13, 3, 0, 10, 2, 6, 4, 7 },
320-
{ 11, 15, 5, 0, 1, 9, 8, 6, 14, 10, 2, 12, 3, 4, 7, 13 }
321-
};
322-
323324
private static int[] compress(
324325
final int[] chainingValue, final int[] blockWords, final int blockLength, final long counter,
325326
final int flags) {

0 commit comments

Comments
 (0)