diff --git a/checkstyle.xml b/checkstyle.xml
index d89b032..00dc4d9 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -85,16 +85,16 @@
-
+
-
+
-
+
diff --git a/src/main/java/at/favre/tools/dice/encode/Encoder.java b/src/main/java/at/favre/tools/dice/encode/Encoder.java
index aeeeb32..0f620e8 100644
--- a/src/main/java/at/favre/tools/dice/encode/Encoder.java
+++ b/src/main/java/at/favre/tools/dice/encode/Encoder.java
@@ -41,6 +41,7 @@ public interface Encoder {
/**
* Description on how the output should be formatted (newlines, separators, etc.)
+ *
* @return
*/
EncoderFormat getEncoderFormat();
diff --git a/src/main/java/at/favre/tools/dice/encode/EncoderHandler.java b/src/main/java/at/favre/tools/dice/encode/EncoderHandler.java
index d528ec1..d1f1ca1 100644
--- a/src/main/java/at/favre/tools/dice/encode/EncoderHandler.java
+++ b/src/main/java/at/favre/tools/dice/encode/EncoderHandler.java
@@ -17,13 +17,40 @@
package at.favre.tools.dice.encode;
import at.favre.lib.bytes.Bytes;
-import at.favre.tools.dice.encode.byteencoder.*;
+import at.favre.tools.dice.encode.byteencoder.AByteEncoder;
+import at.favre.tools.dice.encode.byteencoder.Base10Encoder;
+import at.favre.tools.dice.encode.byteencoder.Base16Encoder;
+import at.favre.tools.dice.encode.byteencoder.Base26Encoder;
+import at.favre.tools.dice.encode.byteencoder.Base2Encoder;
+import at.favre.tools.dice.encode.byteencoder.Base32Encoder;
+import at.favre.tools.dice.encode.byteencoder.Base36Encoder;
+import at.favre.tools.dice.encode.byteencoder.Base58Encoder;
+import at.favre.tools.dice.encode.byteencoder.Base64Encoder;
+import at.favre.tools.dice.encode.byteencoder.Base85Encoder;
+import at.favre.tools.dice.encode.byteencoder.Base8Encoder;
import at.favre.tools.dice.encode.imgencoder.HexBlockImageEncoder;
-import at.favre.tools.dice.encode.languages.*;
+import at.favre.tools.dice.encode.languages.CEncoder;
+import at.favre.tools.dice.encode.languages.CSharpEncoder;
+import at.favre.tools.dice.encode.languages.GoByteArrayEncoder;
+import at.favre.tools.dice.encode.languages.JavaByteArrayEncoder;
+import at.favre.tools.dice.encode.languages.JsEncoder;
+import at.favre.tools.dice.encode.languages.KotlinByteArrayEncoder;
+import at.favre.tools.dice.encode.languages.NodeJsEncoder;
+import at.favre.tools.dice.encode.languages.PerlEncoder;
+import at.favre.tools.dice.encode.languages.PhpEncoder;
+import at.favre.tools.dice.encode.languages.Python3Encoder;
+import at.favre.tools.dice.encode.languages.RubyEncoder;
+import at.favre.tools.dice.encode.languages.RustEncoder;
+import at.favre.tools.dice.encode.languages.SwiftEncoder;
import at.favre.tools.dice.encode.textencoder.RawByteEncoder;
import at.favre.tools.dice.encode.textencoder.Utf8Encoder;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
public final class EncoderHandler {
@@ -116,6 +143,4 @@ public String getSupportedEncodingList() {
sb.delete(sb.length() - 2, sb.length());
return sb.toString();
}
-
-
}
diff --git a/src/main/java/at/favre/tools/dice/encode/byteencoder/AByteRadixEncoder.java b/src/main/java/at/favre/tools/dice/encode/byteencoder/AByteRadixEncoder.java
index 25d670f..e63dd3c 100644
--- a/src/main/java/at/favre/tools/dice/encode/byteencoder/AByteRadixEncoder.java
+++ b/src/main/java/at/favre/tools/dice/encode/byteencoder/AByteRadixEncoder.java
@@ -31,6 +31,4 @@ public String encode(byte[] array) {
public String encodePadded(byte[] array) {
return String.format("%" + maxLength(array, getRadix()) + "s", encode(array)).replace(' ', '0');
}
-
-
}
diff --git a/src/main/java/at/favre/tools/dice/encode/byteencoder/Base2Encoder.java b/src/main/java/at/favre/tools/dice/encode/byteencoder/Base2Encoder.java
index 8faa70b..b04f00c 100644
--- a/src/main/java/at/favre/tools/dice/encode/byteencoder/Base2Encoder.java
+++ b/src/main/java/at/favre/tools/dice/encode/byteencoder/Base2Encoder.java
@@ -25,7 +25,7 @@
*/
public class Base2Encoder extends AByteEncoder {
- private final static int GROUP_LENGTH = 8;
+ private static final int GROUP_LENGTH = 8;
@Override
public String encode(byte[] array) {
diff --git a/src/main/java/at/favre/tools/dice/encode/byteencoder/Base58Encoder.java b/src/main/java/at/favre/tools/dice/encode/byteencoder/Base58Encoder.java
index 9c0a243..5900828 100644
--- a/src/main/java/at/favre/tools/dice/encode/byteencoder/Base58Encoder.java
+++ b/src/main/java/at/favre/tools/dice/encode/byteencoder/Base58Encoder.java
@@ -16,7 +16,6 @@
package at.favre.tools.dice.encode.byteencoder;
-
import at.favre.tools.dice.encode.impl.Base58;
/**
diff --git a/src/main/java/at/favre/tools/dice/encode/byteencoder/Base85Encoder.java b/src/main/java/at/favre/tools/dice/encode/byteencoder/Base85Encoder.java
index 11b3e31..e455dfb 100644
--- a/src/main/java/at/favre/tools/dice/encode/byteencoder/Base85Encoder.java
+++ b/src/main/java/at/favre/tools/dice/encode/byteencoder/Base85Encoder.java
@@ -20,7 +20,7 @@
/**
* Encodes in to ascii85 e.g. 9jqo^BlbD-BleB1DJ
, used by Adobe.
- *
+ *
* See https://github.com/fzakaria/ascii85
*/
public class Base85Encoder extends AByteEncoder {
diff --git a/src/main/java/at/favre/tools/dice/encode/imgencoder/HexBlockImageEncoder.java b/src/main/java/at/favre/tools/dice/encode/imgencoder/HexBlockImageEncoder.java
index b084463..66d0738 100644
--- a/src/main/java/at/favre/tools/dice/encode/imgencoder/HexBlockImageEncoder.java
+++ b/src/main/java/at/favre/tools/dice/encode/imgencoder/HexBlockImageEncoder.java
@@ -21,8 +21,7 @@
public class HexBlockImageEncoder extends AEncoder {
// All possible Blocks: {'▁', '▂', '▃', '▄', '▅', '▆', '▇', '█', '▉', '▊', '▋', '▌', '▍', '▎', '▏', '▐', '░', '▒', '▓', '▔', '▕', '▖', '▗', '▘', '▝', '▚', '▞', '▙', '▛', '▜', '▟'};
- private static final Character[] IMG_CHARS =
- {'▁', '▃', '▅', '▇', '▍', '▐', '░', '▒', '▓', '▖', '▘', '▝', '▚', '▙', '▛', '▜'};
+ private static final Character[] IMG_CHARS = {'▁', '▃', '▅', '▇', '▍', '▐', '░', '▒', '▓', '▖', '▘', '▝', '▚', '▙', '▛', '▜'};
@Override
public String encode(byte[] array) {
diff --git a/src/main/java/at/favre/tools/dice/encode/impl/Base58.java b/src/main/java/at/favre/tools/dice/encode/impl/Base58.java
index 3d432d0..71aaa77 100644
--- a/src/main/java/at/favre/tools/dice/encode/impl/Base58.java
+++ b/src/main/java/at/favre/tools/dice/encode/impl/Base58.java
@@ -43,10 +43,10 @@
* number of leading zeros (which are otherwise lost during the mathematical operations on the
* numbers), and finally represent the resulting base-58 digits as alphanumeric ASCII characters.
*/
-public class Base58 {
- public static final char[] BITCOIN_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".toCharArray();
- public static final char[] RIPPLE_ALPHABET = "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz".toCharArray();
- public static final char[] FLICKR_ALPHABET = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ".toCharArray();
+public final class Base58 {
+ private static final char[] BITCOIN_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".toCharArray();
+ private static final char[] RIPPLE_ALPHABET = "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz".toCharArray();
+ private static final char[] FLICKR_ALPHABET = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ".toCharArray();
public static Base58 BitcoinEncoder() {
return new Base58(BITCOIN_ALPHABET);
@@ -181,4 +181,4 @@ private static byte divmod(byte[] number, int firstDigit, int base, int divisor)
return (byte) remainder;
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/at/favre/tools/dice/rnd/entropy/BCThreadedEntropySource.java b/src/main/java/at/favre/tools/dice/rnd/entropy/BCThreadedEntropySource.java
index e2f855e..6f79e89 100644
--- a/src/main/java/at/favre/tools/dice/rnd/entropy/BCThreadedEntropySource.java
+++ b/src/main/java/at/favre/tools/dice/rnd/entropy/BCThreadedEntropySource.java
@@ -27,7 +27,9 @@
* Threaded Seed Generator based on the one found in Bouncy Castle implementation
*/
public class BCThreadedEntropySource implements ExpandableEntropySource {
- private final static byte[] SALT = new byte[]{0x48, (byte) 0xB8, (byte) 0x96, (byte) 0xC6, (byte) 0x87, 0x5C, (byte) 0xD0, (byte) 0xF9, (byte) 0x9D, 0x60, (byte) 0xFA, 0x11, 0x3E, 0x68, 0x2A, (byte) 0xD0, 0x48, (byte) 0xE3, (byte) 0x83, (byte) 0x90, (byte) 0xA2, 0x3E, 0x79, (byte) 0xCB, 0x52, (byte) 0xBF, (byte) 0xB9, 0x4C, 0x67, 0x1B, (byte) 0xEF, 0x49};
+ private static final byte[] SALT = new byte[]{0x48, (byte) 0xB8, (byte) 0x96, (byte) 0xC6, (byte) 0x87, 0x5C, (byte) 0xD0, (byte) 0xF9, (byte) 0x9D, 0x60,
+ (byte) 0xFA, 0x11, 0x3E, 0x68, 0x2A, (byte) 0xD0, 0x48, (byte) 0xE3, (byte) 0x83, (byte) 0x90, (byte) 0xA2, 0x3E, 0x79, (byte) 0xCB, 0x52, (byte) 0xBF,
+ (byte) 0xB9, 0x4C, 0x67, 0x1B, (byte) 0xEF, 0x49};
private final SeedGenerator threadedSeedGenerator;
private final BlockingQueue buffer = new ArrayBlockingQueue<>(64);
diff --git a/src/main/java/at/favre/tools/dice/rnd/entropy/ExternalStrongSeedEntropySource.java b/src/main/java/at/favre/tools/dice/rnd/entropy/ExternalStrongSeedEntropySource.java
index b594a57..56cd9f5 100644
--- a/src/main/java/at/favre/tools/dice/rnd/entropy/ExternalStrongSeedEntropySource.java
+++ b/src/main/java/at/favre/tools/dice/rnd/entropy/ExternalStrongSeedEntropySource.java
@@ -28,7 +28,8 @@
* adding an monotonic counter, to generate different outputs each call)
*/
public final class ExternalStrongSeedEntropySource implements ExpandableEntropySource {
- private final static byte[] SALT = new byte[]{0x57, 0x58, 0x6E, (byte) 0x9A, 0x7C, (byte) 0xE4, 0x2E, 0x57, 0x61, 0x07, 0x18, (byte) 0xD9, (byte) 0x90, (byte) 0xFE, (byte) 0xC7, 0x2A, (byte) 0xA7, (byte) 0xEE, (byte) 0xFD, 0x10, 0x38, (byte) 0x87, 0x19, (byte) 0x85, (byte) 0xA1, 0x71, 0x3E, 0x31, 0x41, 0x74, 0x60, 0x66};
+ private static final byte[] SALT = new byte[]{0x57, 0x58, 0x6E, (byte) 0x9A, 0x7C, (byte) 0xE4, 0x2E, 0x57, 0x61, 0x07, 0x18, (byte) 0xD9, (byte) 0x90, (byte) 0xFE,
+ (byte) 0xC7, 0x2A, (byte) 0xA7, (byte) 0xEE, (byte) 0xFD, 0x10, 0x38, (byte) 0x87, 0x19, (byte) 0x85, (byte) 0xA1, 0x71, 0x3E, 0x31, 0x41, 0x74, 0x60, 0x66};
private byte[] internalSeed;
private long counter = Long.MIN_VALUE;
diff --git a/src/main/java/at/favre/tools/dice/rnd/entropy/ExternalWeakSeedEntropySource.java b/src/main/java/at/favre/tools/dice/rnd/entropy/ExternalWeakSeedEntropySource.java
index 82ee821..e48e9cd 100644
--- a/src/main/java/at/favre/tools/dice/rnd/entropy/ExternalWeakSeedEntropySource.java
+++ b/src/main/java/at/favre/tools/dice/rnd/entropy/ExternalWeakSeedEntropySource.java
@@ -27,7 +27,9 @@
* therefore mixing the weaker source with a stronger, unpredictable one.
*/
public final class ExternalWeakSeedEntropySource extends SecureRandomEntropySource {
- private static final byte[] SALT = new byte[]{(byte) 0x80, (byte) 0xFD, (byte) 0xDE, 0x4B, (byte) 0xFB, (byte) 0xC9, 0x48, 0x02, (byte) 0xDF, 0x47, (byte) 0x95, (byte) 0xE5, (byte) 0xB1, 0x24, (byte) 0x9C, 0x3F, 0x4A, 0x5C, 0x16, 0x03, 0x0D, 0x18, 0x3B, (byte) 0xB5, 0x3E, 0x26, (byte) 0xBF, (byte) 0xF5, 0x09, 0x79, 0x5F, (byte) 0xA1};
+ private static final byte[] SALT = new byte[]{(byte) 0x80, (byte) 0xFD, (byte) 0xDE, 0x4B, (byte) 0xFB, (byte) 0xC9, 0x48, 0x02, (byte) 0xDF, 0x47,
+ (byte) 0x95, (byte) 0xE5, (byte) 0xB1, 0x24, (byte) 0x9C, 0x3F, 0x4A, 0x5C, 0x16, 0x03, 0x0D, 0x18, 0x3B, (byte) 0xB5, 0x3E, 0x26, (byte) 0xBF,
+ (byte) 0xF5, 0x09, 0x79, 0x5F, (byte) 0xA1};
public ExternalWeakSeedEntropySource(String seed) {
this(seed.getBytes(StandardCharsets.UTF_8));
diff --git a/src/main/java/at/favre/tools/dice/rnd/entropy/HKDFEntropyPool.java b/src/main/java/at/favre/tools/dice/rnd/entropy/HKDFEntropyPool.java
index b9ad07b..ad397aa 100644
--- a/src/main/java/at/favre/tools/dice/rnd/entropy/HKDFEntropyPool.java
+++ b/src/main/java/at/favre/tools/dice/rnd/entropy/HKDFEntropyPool.java
@@ -31,14 +31,15 @@
* bit strings.
*/
public final class HKDFEntropyPool implements EntropyPool {
- private final static int DEFAULT_INTERNAL_SEED_LENGTH = 32;
- private final static byte[] SALT = new byte[]{0x0B, 0x40, (byte) 0xC3, (byte) 0x91, 0x73, (byte) 0x88, 0x58, 0x6A, 0x22, (byte) 0xD4, (byte) 0xC3, 0x04, 0x16, 0x1F, (byte) 0xB9, (byte) 0xE7, 0x21, 0x50, 0x4E, (byte) 0x8A, (byte) 0xDC, 0x0D, 0x6C, (byte) 0xCC, (byte) 0x90, 0x5A, 0x7A, 0x1C, 0x2A, (byte) 0xBB, 0x38, (byte) 0xE8};
+ private static final int DEFAULT_INTERNAL_SEED_LENGTH = 32;
+ private static final byte[] SALT = new byte[]{0x0B, 0x40, (byte) 0xC3, (byte) 0x91, 0x73, (byte) 0x88, 0x58, 0x6A, 0x22, (byte) 0xD4, (byte) 0xC3,
+ 0x04, 0x16, 0x1F, (byte) 0xB9, (byte) 0xE7, 0x21, 0x50, 0x4E, (byte) 0x8A, (byte) 0xDC, 0x0D, 0x6C, (byte) 0xCC, (byte) 0x90, 0x5A, 0x7A,
+ 0x1C, 0x2A, (byte) 0xBB, 0x38, (byte) 0xE8};
private final List entropySourceList = new LinkedList<>();
private final int sourceSeedLengthBytes;
-
public HKDFEntropyPool() {
this(DEFAULT_INTERNAL_SEED_LENGTH);
}
diff --git a/src/main/java/at/favre/tools/dice/rnd/entropy/JDKThreadedEntropySource.java b/src/main/java/at/favre/tools/dice/rnd/entropy/JDKThreadedEntropySource.java
index e9d6f72..c0bd7c2 100644
--- a/src/main/java/at/favre/tools/dice/rnd/entropy/JDKThreadedEntropySource.java
+++ b/src/main/java/at/favre/tools/dice/rnd/entropy/JDKThreadedEntropySource.java
@@ -31,7 +31,9 @@
* environment provides good entropy.
*/
public final class JDKThreadedEntropySource implements ExpandableEntropySource {
- private final static byte[] SALT = new byte[]{0x75, (byte) 0xCC, 0x3A, 0x7B, 0x21, 0x6D, 0x08, (byte) 0xAD, (byte) 0xD9, (byte) 0xD7, (byte) 0xA3, 0x35, 0x1C, 0x56, 0x13, 0x2C, 0x44, 0x2E, 0x74, (byte) 0xB2, 0x14, 0x2C, 0x15, 0x39, 0x5A, (byte) 0xC6, (byte) 0xBA, 0x3C, (byte) 0xCF, 0x71, 0x19, 0x2B};
+ private static final byte[] SALT = new byte[]{0x75, (byte) 0xCC, 0x3A, 0x7B, 0x21, 0x6D, 0x08, (byte) 0xAD, (byte) 0xD9, (byte) 0xD7, (byte) 0xA3,
+ 0x35, 0x1C, 0x56, 0x13, 0x2C, 0x44, 0x2E, 0x74, (byte) 0xB2, 0x14, 0x2C, 0x15, 0x39, 0x5A, (byte) 0xC6, (byte) 0xBA, 0x3C, (byte) 0xCF,
+ 0x71, 0x19, 0x2B};
private final ThreadedSeedGenerator threadedSeedGenerator;
@@ -101,21 +103,19 @@ private static class ThreadedSeedGenerator implements Runnable {
start = end = 0;
final ThreadGroup[] finalsg = new ThreadGroup[1];
- Thread t = java.security.AccessController.doPrivileged
- ((PrivilegedAction) () -> {
- ThreadGroup parent, group =
- Thread.currentThread().getThreadGroup();
- while ((parent = group.getParent()) != null)
- group = parent;
- finalsg[0] = new ThreadGroup
- (group, "Dice SeedGenerator ThreadGroup");
- Thread newT = new Thread(finalsg[0],
- ThreadedSeedGenerator.this,
- "Dice SeedGenerator Thread");
- newT.setPriority(Thread.MIN_PRIORITY);
- newT.setDaemon(true);
- return newT;
- });
+ Thread t = java.security.AccessController.doPrivileged((PrivilegedAction) () -> {
+ ThreadGroup parent, group = Thread.currentThread().getThreadGroup();
+ while ((parent = group.getParent()) != null) {
+ group = parent;
+ }
+ finalsg[0] = new ThreadGroup(group, "Dice SeedGenerator ThreadGroup");
+ Thread newT = new Thread(finalsg[0],
+ ThreadedSeedGenerator.this,
+ "Dice SeedGenerator Thread");
+ newT.setPriority(Thread.MIN_PRIORITY);
+ newT.setDaemon(true);
+ return newT;
+ });
seedGroup = finalsg[0];
t.start();
}
@@ -124,7 +124,7 @@ private static class ThreadedSeedGenerator implements Runnable {
* This method does the actual work. It collects random bytes and
* pushes them into the queue.
*/
- final public void run() {
+ public final void run() {
try {
while (true) {
// Queue full? Wait till there's room.
@@ -143,8 +143,7 @@ final public void run() {
// Start some noisy threads
try {
BogusThread bt = new BogusThread();
- Thread t = new Thread
- (seedGroup, bt, "Dice SeedGenerator Thread");
+ Thread t = new Thread(seedGroup, bt, "Dice SeedGenerator Thread");
t.start();
} catch (Exception e) {
throw new InternalError("internal error: " +
@@ -154,7 +153,6 @@ final public void run() {
// We wait 250milli quanta, so the minimum wait time
// cannot be under 250milli.
int latch = 0;
- latch = 0;
long l = System.currentTimeMillis() + 50;
while (System.currentTimeMillis() < l) {
synchronized (this) {
@@ -230,12 +228,12 @@ byte getSeedByte() {
*/
private static class BogusThread implements Runnable {
- final public void run() {
+ public final void run() {
try {
for (int i = 0; i < 5; i++)
Thread.sleep(50);
// System.gc();
- } catch (Exception e) {
+ } catch (Exception ignored) {
}
}
}
diff --git a/src/main/java/at/favre/tools/dice/rnd/entropy/NonceEntropySource.java b/src/main/java/at/favre/tools/dice/rnd/entropy/NonceEntropySource.java
index e25b245..18210d8 100644
--- a/src/main/java/at/favre/tools/dice/rnd/entropy/NonceEntropySource.java
+++ b/src/main/java/at/favre/tools/dice/rnd/entropy/NonceEntropySource.java
@@ -31,7 +31,9 @@
* See http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90Ar1.pdf Section 8.6.7.
*/
public final class NonceEntropySource implements ExpandableEntropySource {
- private final static byte[] SALT = new byte[]{0x48, (byte) 0xB8, (byte) 0x96, (byte) 0xC6, (byte) 0x87, 0x5C, (byte) 0xD0, (byte) 0xF9, (byte) 0x9D, 0x60, (byte) 0xFA, 0x11, 0x3E, 0x68, 0x2A, (byte) 0xD0, 0x48, (byte) 0xE3, (byte) 0x83, (byte) 0x90, (byte) 0xA2, 0x3E, 0x79, (byte) 0xCB, 0x52, (byte) 0xBF, (byte) 0xB9, 0x4C, 0x67, 0x1B, (byte) 0xEF, 0x49};
+ private static final byte[] SALT = new byte[]{0x48, (byte) 0xB8, (byte) 0x96, (byte) 0xC6, (byte) 0x87, 0x5C, (byte) 0xD0, (byte) 0xF9, (byte) 0x9D,
+ 0x60, (byte) 0xFA, 0x11, 0x3E, 0x68, 0x2A, (byte) 0xD0, 0x48, (byte) 0xE3, (byte) 0x83, (byte) 0x90, (byte) 0xA2, 0x3E, 0x79, (byte) 0xCB,
+ 0x52, (byte) 0xBF, (byte) 0xB9, 0x4C, 0x67, 0x1B, (byte) 0xEF, 0x49};
private long sequenceCounter;
private long lastAccess = System.nanoTime();
diff --git a/src/main/java/at/favre/tools/dice/rnd/entropy/PersonalizationSource.java b/src/main/java/at/favre/tools/dice/rnd/entropy/PersonalizationSource.java
index 39e5090..16bf43e 100644
--- a/src/main/java/at/favre/tools/dice/rnd/entropy/PersonalizationSource.java
+++ b/src/main/java/at/favre/tools/dice/rnd/entropy/PersonalizationSource.java
@@ -34,7 +34,11 @@
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.util.*;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Random;
/**
* Reads static and dynamic data from the machine like MAC addresses and cpu usage to pin the
@@ -46,8 +50,10 @@
* See: http://csrc.nist.gov/publications/nistpubs/800-90A/SP800-90A.pdf
*/
public final class PersonalizationSource implements ExpandableEntropySource {
- private static final byte[] STATIC_RANDOM = new byte[]{0x0B, 0x40, (byte) 0xC3, (byte) 0x91, 0x73, (byte) 0x88, 0x58, 0x6A, 0x22, (byte) 0xD4, (byte) 0xC3, 0x04, 0x16, 0x1F, (byte) 0xB9, (byte) 0xE7, 0x21, 0x50, 0x4E, (byte) 0x8A, (byte) 0xDC, 0x0D, 0x6C, (byte) 0xCC, (byte) 0x90, 0x5A, 0x7A, 0x1C, 0x2A, (byte) 0xBB, 0x38, (byte) 0xE8};
- private static final byte[] SALT = new byte[]{0x0B, 0x40, (byte) 0xC3, (byte) 0x91, 0x73, (byte) 0x88, 0x58, 0x6A, 0x22, (byte) 0xD4, (byte) 0xC3, 0x04, 0x16, 0x1F, (byte) 0xB9, (byte) 0xE7, 0x21, 0x50, 0x4E, (byte) 0x8A, (byte) 0xDC, 0x0D, 0x6C, (byte) 0xCC, (byte) 0x90, 0x5A, 0x7A, 0x1C, 0x2A, (byte) 0xBB, 0x38, (byte) 0xE8};
+ private static final byte[] STATIC_RANDOM = new byte[]{0x0B, 0x40, (byte) 0xC3, (byte) 0x91, 0x73, (byte) 0x88, 0x58, 0x6A, 0x22, (byte) 0xD4, (byte) 0xC3, 0x04, 0x16, 0x1F,
+ (byte) 0xB9, (byte) 0xE7, 0x21, 0x50, 0x4E, (byte) 0x8A, (byte) 0xDC, 0x0D, 0x6C, (byte) 0xCC, (byte) 0x90, 0x5A, 0x7A, 0x1C, 0x2A, (byte) 0xBB, 0x38, (byte) 0xE8};
+ private static final byte[] SALT = new byte[]{0x0B, 0x40, (byte) 0xC3, (byte) 0x91, 0x73, (byte) 0x88, 0x58, 0x6A, 0x22, (byte) 0xD4, (byte) 0xC3, 0x04, 0x16, 0x1F, (byte) 0xB9,
+ (byte) 0xE7, 0x21, 0x50, 0x4E, (byte) 0x8A, (byte) 0xDC, 0x0D, 0x6C, (byte) 0xCC, (byte) 0x90, 0x5A, 0x7A, 0x1C, 0x2A, (byte) 0xBB, 0x38, (byte) 0xE8};
private byte[] readTempDirContent() {
File f = new File(System.getProperty("java.io.tmpdir"));
diff --git a/src/main/java/at/favre/tools/dice/service/AServiceHandler.java b/src/main/java/at/favre/tools/dice/service/AServiceHandler.java
index 694a5dc..c22c4c7 100644
--- a/src/main/java/at/favre/tools/dice/service/AServiceHandler.java
+++ b/src/main/java/at/favre/tools/dice/service/AServiceHandler.java
@@ -26,7 +26,7 @@
import java.util.concurrent.TimeUnit;
public abstract class AServiceHandler implements ServiceHandler {
- private final static String USER_AGENT = "dice/" + MiscUtil.jarVersion() + " (" + System.getProperty("os.name") + "; Java " + System.getProperty("java.version") + ") github.com/patrickfav/dice";
+ private static final String USER_AGENT = "dice/" + MiscUtil.jarVersion() + " (" + System.getProperty("os.name") + "; Java " + System.getProperty("java.version") + ") github.com/patrickfav/dice";
protected final boolean debug;
protected AServiceHandler(boolean debug) {
diff --git a/src/main/java/at/favre/tools/dice/service/anuquantum/AnuQuantumServiceHandler.java b/src/main/java/at/favre/tools/dice/service/anuquantum/AnuQuantumServiceHandler.java
index 2939e5d..158e64c 100644
--- a/src/main/java/at/favre/tools/dice/service/anuquantum/AnuQuantumServiceHandler.java
+++ b/src/main/java/at/favre/tools/dice/service/anuquantum/AnuQuantumServiceHandler.java
@@ -32,7 +32,7 @@
* See https://qrng.anu.edu.au/
*/
public final class AnuQuantumServiceHandler extends AServiceHandler {
- final static int ENTROPY_SEED_LENGTH_BYTE = 24;
+ static final int ENTROPY_SEED_LENGTH_BYTE = 24;
public AnuQuantumServiceHandler(boolean debug) {
super(debug);
diff --git a/src/main/java/at/favre/tools/dice/service/hotbits/HotbitsServiceHandler.java b/src/main/java/at/favre/tools/dice/service/hotbits/HotbitsServiceHandler.java
index 0bdf89c..d613a92 100644
--- a/src/main/java/at/favre/tools/dice/service/hotbits/HotbitsServiceHandler.java
+++ b/src/main/java/at/favre/tools/dice/service/hotbits/HotbitsServiceHandler.java
@@ -32,7 +32,7 @@
* See https://www.fourmilab.ch/hotbits/
*/
public final class HotbitsServiceHandler extends AServiceHandler {
- final static int ENTROPY_SEED_LENGTH_BYTE = 24;
+ static final int ENTROPY_SEED_LENGTH_BYTE = 24;
public HotbitsServiceHandler(boolean debug) {
super(debug);
diff --git a/src/main/java/at/favre/tools/dice/service/randomorg/RandomOrgService.java b/src/main/java/at/favre/tools/dice/service/randomorg/RandomOrgService.java
index 377b484..b195c04 100644
--- a/src/main/java/at/favre/tools/dice/service/randomorg/RandomOrgService.java
+++ b/src/main/java/at/favre/tools/dice/service/randomorg/RandomOrgService.java
@@ -29,4 +29,4 @@ public interface RandomOrgService {
@Headers({"DNT: 1"})
@POST("/json-rpc/1/invoke")
Call getRandom(@HeaderMap Map headers, @Body RandomOrgBlobRequest request);
-}
\ No newline at end of file
+}
diff --git a/src/main/java/at/favre/tools/dice/service/randomorg/RandomOrgServiceHandler.java b/src/main/java/at/favre/tools/dice/service/randomorg/RandomOrgServiceHandler.java
index 007bf15..0b2eb4e 100644
--- a/src/main/java/at/favre/tools/dice/service/randomorg/RandomOrgServiceHandler.java
+++ b/src/main/java/at/favre/tools/dice/service/randomorg/RandomOrgServiceHandler.java
@@ -38,7 +38,7 @@
* See https://www.random.org/
*/
public final class RandomOrgServiceHandler extends AServiceHandler {
- final static int ENTROPY_SEED_LENGTH_BIT = 192;
+ static final int ENTROPY_SEED_LENGTH_BIT = 192;
public RandomOrgServiceHandler(boolean debug) {
super(debug);
diff --git a/src/main/java/at/favre/tools/dice/service/randomorg/RandomOrgUtil.java b/src/main/java/at/favre/tools/dice/service/randomorg/RandomOrgUtil.java
index b757f4a..44f77a7 100644
--- a/src/main/java/at/favre/tools/dice/service/randomorg/RandomOrgUtil.java
+++ b/src/main/java/at/favre/tools/dice/service/randomorg/RandomOrgUtil.java
@@ -35,7 +35,33 @@
* See https://api.random.org/verify/manual
*/
final class RandomOrgUtil {
- static final String RANDOM_ORG_PUB_KEY = "MIIIqjCCB5KgAwIBAgIQC4lCuW7RYqlTYGF+/nJQaDANBgkqhkiG9w0BAQsFADB1MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMTQwMgYDVQQDEytEaWdpQ2VydCBTSEEyIEV4dGVuZGVkIFZhbGlkYXRpb24gU2VydmVyIENBMB4XDTE3MDgxMDAwMDAwMFoXDTE5MTAxNzEyMDAwMFowgbUxHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5pemF0aW9uMRMwEQYLKwYBBAGCNzwCAQMTAklFMQ8wDQYDVQQFEwY0ODk0MzQxCzAJBgNVBAYTAklFMQ8wDQYDVQQHEwZEdWJsaW4xOzA5BgNVBAoTMlJBTkRPTS5PUkcgKFJhbmRvbW5lc3MgYW5kIEludGVncml0eSBTZXJ2aWNlcyBMdGQpMRMwEQYDVQQDEwpSQU5ET00uT1JHMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA7O3HQWLnTzCCj/qwoI4vj/T9237we74rwcJW2w4SuzIKVlAn5yhaJcaeQpdpmHwmQt3aU8G1ba7n3xl7hdePkh+aEkYM3iVOhJZdkCKjzw2x7lUSQInZksgns8R4iGklJPInX6fmBjErt1YrjI8B5Hqz3koibkqIZgVuZ1QfJogbmsrT64imgiDdeG3XDcOY4yDzS734bNqRUNYha3aDnwvxrubyMhfWtBl2y6nXKDbeMKJ9NWu723V7L+BGFeEvYMPq8ieRVJ7ycavKeSXEoi9GvgzCjuy2GBJOXs41O5f07Vnq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{
static String base64EncodedSha512(String raw) {
return new Base64().encodeToString(sha512(raw));
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/at/favre/tools/dice/service/randomorg/model/RandomOrgBlobRequest.java b/src/main/java/at/favre/tools/dice/service/randomorg/model/RandomOrgBlobRequest.java
index b91196a..b5a738d 100644
--- a/src/main/java/at/favre/tools/dice/service/randomorg/model/RandomOrgBlobRequest.java
+++ b/src/main/java/at/favre/tools/dice/service/randomorg/model/RandomOrgBlobRequest.java
@@ -66,4 +66,4 @@ public Params(String apiKey, int n, int size) {
// How many random blobs you need. Must be within the [1,100] range.
// size
// The size of each blob, measured in bits. Must be within the [1,1048576] range and must be divisible by 8.
-// The total size of all blobs requested must not exceed 1,048,576 bits (128 KiB).
\ No newline at end of file
+// The total size of all blobs requested must not exceed 1,048,576 bits (128 KiB).
diff --git a/src/main/java/at/favre/tools/dice/ui/CLIParser.java b/src/main/java/at/favre/tools/dice/ui/CLIParser.java
index 68b44a3..4859dd4 100644
--- a/src/main/java/at/favre/tools/dice/ui/CLIParser.java
+++ b/src/main/java/at/favre/tools/dice/ui/CLIParser.java
@@ -18,12 +18,18 @@
import at.favre.tools.dice.encode.EncoderHandler;
import at.favre.tools.dice.util.MiscUtil;
-import org.apache.commons.cli.*;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionGroup;
+import org.apache.commons.cli.Options;
import java.io.File;
import java.util.List;
-public class CLIParser {
+public final class CLIParser {
static final String ARG_ENCODING = "e";
static final String ARG_COUNT = "c";
static final String ARG_SEED = "s";
@@ -36,6 +42,9 @@ public class CLIParser {
static final String ARG_CRC32 = "crc32";
static final String ARG_OUTFILE = "f";
+ private CLIParser() {
+ }
+
public static Arg parse(String[] args) {
Options options = setupOptions();
CommandLineParser parser = new DefaultParser();
diff --git a/src/main/java/at/favre/tools/dice/util/MiscUtil.java b/src/main/java/at/favre/tools/dice/util/MiscUtil.java
index 60b6139..e662658 100644
--- a/src/main/java/at/favre/tools/dice/util/MiscUtil.java
+++ b/src/main/java/at/favre/tools/dice/util/MiscUtil.java
@@ -21,6 +21,10 @@
import java.util.Properties;
public final class MiscUtil {
+
+ private MiscUtil() {
+ }
+
/**
*
* Checks if a string is a valid path.
@@ -46,7 +50,6 @@ public static boolean isValidPath(String path) {
return true;
}
-
public static String jarVersion() {
String version = MiscUtil.class.getPackage().getImplementationVersion();
if (version == null) {
diff --git a/src/test/java/at/favre/tools/dice/RndToolTest.java b/src/test/java/at/favre/tools/dice/RndToolTest.java
index d7b887d..9a74870 100644
--- a/src/test/java/at/favre/tools/dice/RndToolTest.java
+++ b/src/test/java/at/favre/tools/dice/RndToolTest.java
@@ -44,7 +44,7 @@ public void smokeTestRndTool() throws Exception {
@NotNull
private PrintStream createPrintStream(ByteArrayOutputStream baos) throws UnsupportedEncodingException {
- return new PrintStream(baos, true, "utf-8");
+ return new PrintStream(baos, true, StandardCharsets.UTF_8);
}
@Test(expected = AppException.class)
@@ -101,4 +101,4 @@ public void testOutFile() throws Exception {
assertEquals(length * count, tempFile.length());
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/AEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/AEncoderTest.java
index b80d256..36ecda6 100644
--- a/src/test/java/at/favre/tools/dice/encode/AEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/AEncoderTest.java
@@ -84,4 +84,4 @@ private static void checkRndDistribution(int max) {
System.out.println(entry.getKey() + ":" + entry.getValue());
}
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/Base10EncoderTest.java b/src/test/java/at/favre/tools/dice/encode/Base10EncoderTest.java
index ec2e1b6..0a5d02e 100644
--- a/src/test/java/at/favre/tools/dice/encode/Base10EncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/Base10EncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new Base10Encoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/Base16LowerCaseEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/Base16LowerCaseEncoderTest.java
index ab682f0..8d1a43e 100644
--- a/src/test/java/at/favre/tools/dice/encode/Base16LowerCaseEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/Base16LowerCaseEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new Base16Encoder.Base16LowerCaseEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/Base16UpperCaseEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/Base16UpperCaseEncoderTest.java
index db46ac7..64a0cb8 100644
--- a/src/test/java/at/favre/tools/dice/encode/Base16UpperCaseEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/Base16UpperCaseEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new Base16Encoder.Base16UpperCaseEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/Base26EncoderTest.java b/src/test/java/at/favre/tools/dice/encode/Base26EncoderTest.java
index 9f346d8..78b86fd 100644
--- a/src/test/java/at/favre/tools/dice/encode/Base26EncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/Base26EncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new Base26Encoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/Base2EncoderTest.java b/src/test/java/at/favre/tools/dice/encode/Base2EncoderTest.java
index 3cd99df..0269ee9 100644
--- a/src/test/java/at/favre/tools/dice/encode/Base2EncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/Base2EncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new Base2Encoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/Base32EncoderTest.java b/src/test/java/at/favre/tools/dice/encode/Base32EncoderTest.java
index fc143ce..7dc163a 100644
--- a/src/test/java/at/favre/tools/dice/encode/Base32EncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/Base32EncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new Base32Encoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/Base36EncoderTest.java b/src/test/java/at/favre/tools/dice/encode/Base36EncoderTest.java
index 6e105d6..0347c09 100644
--- a/src/test/java/at/favre/tools/dice/encode/Base36EncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/Base36EncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new Base36Encoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/Base58EncoderTest.java b/src/test/java/at/favre/tools/dice/encode/Base58EncoderTest.java
index 02348db..a7cf87f 100644
--- a/src/test/java/at/favre/tools/dice/encode/Base58EncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/Base58EncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new Base58Encoder.BitcoinStyle();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/Base64EncoderTest.java b/src/test/java/at/favre/tools/dice/encode/Base64EncoderTest.java
index 877a92a..27c7bdd 100644
--- a/src/test/java/at/favre/tools/dice/encode/Base64EncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/Base64EncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new Base64Encoder.Default();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/Base64UrlSafeEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/Base64UrlSafeEncoderTest.java
index f225396..0c42e61 100644
--- a/src/test/java/at/favre/tools/dice/encode/Base64UrlSafeEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/Base64UrlSafeEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new Base64Encoder.UrlSafe();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/Base85EncoderTest.java b/src/test/java/at/favre/tools/dice/encode/Base85EncoderTest.java
index cd07252..c8719c0 100644
--- a/src/test/java/at/favre/tools/dice/encode/Base85EncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/Base85EncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new Base85Encoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/Base8EncoderTest.java b/src/test/java/at/favre/tools/dice/encode/Base8EncoderTest.java
index f53dd9c..440f2ab 100644
--- a/src/test/java/at/favre/tools/dice/encode/Base8EncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/Base8EncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new Base8Encoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/CEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/CEncoderTest.java
index b41de93..d5ab58b 100644
--- a/src/test/java/at/favre/tools/dice/encode/CEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/CEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new CEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/CSharpEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/CSharpEncoderTest.java
index b15d8b7..2038da7 100644
--- a/src/test/java/at/favre/tools/dice/encode/CSharpEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/CSharpEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new CSharpEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/CompressionTest.java b/src/test/java/at/favre/tools/dice/encode/CompressionTest.java
index b9a68e0..10cc906 100644
--- a/src/test/java/at/favre/tools/dice/encode/CompressionTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/CompressionTest.java
@@ -13,7 +13,11 @@
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Random;
import java.util.zip.GZIPOutputStream;
@Ignore("simple test for the best encoding while compressed - only run on demand")
@@ -28,14 +32,14 @@ public void testRandomData() throws Exception {
@Test
public void testImage1() throws Exception {
File imageFile = new File(getClass().getClassLoader().getResource("example_image1.base64").toURI().getPath());
- String content = new String(Files.readAllBytes(imageFile.toPath()), "UTF-8");
+ String content = new String(Files.readAllBytes(imageFile.toPath()), StandardCharsets.UTF_8);
testAllByteEncoder(content.getBytes(StandardCharsets.UTF_8));
}
@Test
public void testLogData() throws Exception {
File logFile1 = new File(getClass().getClassLoader().getResource("example_log1.txt").toURI().getPath());
- String logContent1 = new String(Files.readAllBytes(logFile1.toPath()), "UTF-8");
+ String logContent1 = new String(Files.readAllBytes(logFile1.toPath()), StandardCharsets.UTF_8);
testAllByteEncoder(logContent1.getBytes(StandardCharsets.UTF_8));
}
@@ -135,7 +139,6 @@ private static String differencePercent(int originalLength, int differentLength)
return byteDiff + " byte [+" + percent + "%]";
}
-
private static byte[] compress(byte[] data) throws Exception {
try (ByteArrayOutputStream bos = new ByteArrayOutputStream(data.length)) {
GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bos);
diff --git a/src/test/java/at/favre/tools/dice/encode/EncoderHandlerTest.java b/src/test/java/at/favre/tools/dice/encode/EncoderHandlerTest.java
index 32c1d3f..f5cefad 100644
--- a/src/test/java/at/favre/tools/dice/encode/EncoderHandlerTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/EncoderHandlerTest.java
@@ -123,4 +123,4 @@ private String getLanguageEncoderMarkdownTable() {
}
return sb.toString();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/GoEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/GoEncoderTest.java
index dab0ae9..0788df9 100644
--- a/src/test/java/at/favre/tools/dice/encode/GoEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/GoEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new GoByteArrayEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/HexImageEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/HexImageEncoderTest.java
index cf320aa..2ceefbc 100644
--- a/src/test/java/at/favre/tools/dice/encode/HexImageEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/HexImageEncoderTest.java
@@ -28,4 +28,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new HexBlockImageEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/JavaByteArrayEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/JavaByteArrayEncoderTest.java
index 43f659c..9126339 100644
--- a/src/test/java/at/favre/tools/dice/encode/JavaByteArrayEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/JavaByteArrayEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new JavaByteArrayEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/JsEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/JsEncoderTest.java
index 52d2a2d..4a0899f 100644
--- a/src/test/java/at/favre/tools/dice/encode/JsEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/JsEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new JsEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/KotlinByteArrayEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/KotlinByteArrayEncoderTest.java
index 122e04f..a02ed17 100644
--- a/src/test/java/at/favre/tools/dice/encode/KotlinByteArrayEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/KotlinByteArrayEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new KotlinByteArrayEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/NodeJsEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/NodeJsEncoderTest.java
index 6b0d3bd..35eb4c0 100644
--- a/src/test/java/at/favre/tools/dice/encode/NodeJsEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/NodeJsEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new NodeJsEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/PerlEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/PerlEncoderTest.java
index 9781d08..28094a0 100644
--- a/src/test/java/at/favre/tools/dice/encode/PerlEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/PerlEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new PerlEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/PhpEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/PhpEncoderTest.java
index c3c24bb..d4f1e64 100644
--- a/src/test/java/at/favre/tools/dice/encode/PhpEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/PhpEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new PhpEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/Python3EncoderTest.java b/src/test/java/at/favre/tools/dice/encode/Python3EncoderTest.java
index 80f2579..424cb09 100644
--- a/src/test/java/at/favre/tools/dice/encode/Python3EncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/Python3EncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new Python3Encoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/RubyEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/RubyEncoderTest.java
index b580760..aeaaab3 100644
--- a/src/test/java/at/favre/tools/dice/encode/RubyEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/RubyEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new RubyEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/RustEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/RustEncoderTest.java
index 469dba2..7c2553d 100644
--- a/src/test/java/at/favre/tools/dice/encode/RustEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/RustEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new RustEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/SwiftEncoderTest.java b/src/test/java/at/favre/tools/dice/encode/SwiftEncoderTest.java
index f4bc6fc..259e99f 100644
--- a/src/test/java/at/favre/tools/dice/encode/SwiftEncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/SwiftEncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new SwiftEncoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/Utf8EncoderTest.java b/src/test/java/at/favre/tools/dice/encode/Utf8EncoderTest.java
index 56e6cbe..0585a12 100644
--- a/src/test/java/at/favre/tools/dice/encode/Utf8EncoderTest.java
+++ b/src/test/java/at/favre/tools/dice/encode/Utf8EncoderTest.java
@@ -12,4 +12,4 @@ void check(byte[] original, String encode) {
Encoder createInstance() {
return new Utf8Encoder();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/encode/impl/Base58Test.java b/src/test/java/at/favre/tools/dice/encode/impl/Base58Test.java
index 40da81d..0c27454 100644
--- a/src/test/java/at/favre/tools/dice/encode/impl/Base58Test.java
+++ b/src/test/java/at/favre/tools/dice/encode/impl/Base58Test.java
@@ -37,5 +37,4 @@ private void testEncode(Base58 base58) throws Exception {
assertTrue(Arrays.equals(randomBytes, decoded));
}
}
-
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/rnd/AHmacDrbgNistTestVectorsTest.java b/src/test/java/at/favre/tools/dice/rnd/AHmacDrbgNistTestVectorsTest.java
index d8b58c5..0a30284 100644
--- a/src/test/java/at/favre/tools/dice/rnd/AHmacDrbgNistTestVectorsTest.java
+++ b/src/test/java/at/favre/tools/dice/rnd/AHmacDrbgNistTestVectorsTest.java
@@ -82,4 +82,4 @@ byte[] hex(String hex) {
throw new IllegalStateException(e);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/rnd/HmacDrbgSha1NistTestVectors.java b/src/test/java/at/favre/tools/dice/rnd/HmacDrbgSha1NistTestVectors.java
index 2eb0a6f..0f9145d 100644
--- a/src/test/java/at/favre/tools/dice/rnd/HmacDrbgSha1NistTestVectors.java
+++ b/src/test/java/at/favre/tools/dice/rnd/HmacDrbgSha1NistTestVectors.java
@@ -20,7 +20,7 @@
public class HmacDrbgSha1NistTestVectors extends AHmacDrbgNistTestVectorsTest {
- private final static int DEFAULT_NIST_OUT_LENGTH_BIT = 640;
+ private static final int DEFAULT_NIST_OUT_LENGTH_BIT = 640;
@Test
public void testHmacDrbgNistCase0() {
@@ -67,7 +67,6 @@ public void testHmacDrbgNistCase4() {
testDrbg(entropy, nonce, new byte[0], expected);
}
-
@Test
public void testHmacDrbgNistCase5() {
byte[] entropy = hex("6b20dda65a96f564fc0253d38dbc290b");
@@ -95,7 +94,6 @@ public void testHmacDrbgNistCase7() {
testDrbg(entropy, nonce, new byte[0], expected);
}
-
@Test
public void testHmacDrbgNistCase8() {
byte[] entropy = hex("6425624a98ab3018eb4ef827f5a4fbba");
@@ -258,4 +256,4 @@ private void testDrbgReseed(byte[] entropy, byte[] reseed, byte[] nonce, byte[]
private void testDrbgReseedWithAdditionalInfo(byte[] entropy, byte[] reseed, byte[] nonce, byte[] perso, byte[] additonalInputReseed, byte[] additonalInput1, byte[] additonalInput2, byte[] expected) {
testDrbgReseed(MacFactory.Default.hmacSha1(), entropy, reseed, nonce, perso, additonalInputReseed, additonalInput1, additonalInput2, expected, DEFAULT_NIST_OUT_LENGTH_BIT);
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/rnd/HmacDrbgSha256NistTestVectors.java b/src/test/java/at/favre/tools/dice/rnd/HmacDrbgSha256NistTestVectors.java
index 5b311d2..35b123b 100644
--- a/src/test/java/at/favre/tools/dice/rnd/HmacDrbgSha256NistTestVectors.java
+++ b/src/test/java/at/favre/tools/dice/rnd/HmacDrbgSha256NistTestVectors.java
@@ -19,7 +19,7 @@
import org.junit.Test;
public class HmacDrbgSha256NistTestVectors extends AHmacDrbgNistTestVectorsTest {
- private final static int DEFAULT_NIST_OUT_LENGTH_BIT = 1024;
+ private static final int DEFAULT_NIST_OUT_LENGTH_BIT = 1024;
// ==== Test vectors for HMAC_DRBG with no personalization. ====
@Test
@@ -551,4 +551,4 @@ private void testDrbgReseed(byte[] entropy, byte[] reseed, byte[] nonce, byte[]
private void testDrbgReseedWithAdditionalInfo(byte[] entropy, byte[] reseed, byte[] nonce, byte[] perso, byte[] additonalInputReseed, byte[] additonalInput1, byte[] additonalInput2, byte[] expected) {
testDrbgReseed(MacFactory.Default.hmacSha256(), entropy, reseed, nonce, perso, additonalInputReseed, additonalInput1, additonalInput2, expected, DEFAULT_NIST_OUT_LENGTH_BIT);
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/rnd/HmacDrbgSha512NistTestVectors.java b/src/test/java/at/favre/tools/dice/rnd/HmacDrbgSha512NistTestVectors.java
index cdd3c5f..47348bf 100644
--- a/src/test/java/at/favre/tools/dice/rnd/HmacDrbgSha512NistTestVectors.java
+++ b/src/test/java/at/favre/tools/dice/rnd/HmacDrbgSha512NistTestVectors.java
@@ -19,7 +19,7 @@
import org.junit.Test;
public class HmacDrbgSha512NistTestVectors extends AHmacDrbgNistTestVectorsTest {
- private final static int DEFAULT_NIST_OUT_LENGTH_BIT = 2048;
+ private static final int DEFAULT_NIST_OUT_LENGTH_BIT = 2048;
@Test
public void testHmacDrbgNistCase0() {
@@ -68,7 +68,6 @@ public void testHmacDrbgNistCase4() {
testDrbg(entropy, nonce, new byte[0], expected);
}
-
@Test
public void testHmacDrbgNistCase5() {
byte[] entropy = hex("a14be417001030f6a9c543f829715b075d0efd8fa35acc7eed02a1401c6f59df");
@@ -96,7 +95,6 @@ public void testHmacDrbgNistCase7() {
testDrbg(entropy, nonce, new byte[0], expected);
}
-
@Test
public void testHmacDrbgNistCase8() {
byte[] entropy = hex("e8a0925bfce66dee7e6a54fe0311d259bd7f7a22b8576d64840cc51c731212cb");
@@ -260,4 +258,4 @@ private void testDrbgReseed(byte[] entropy, byte[] reseed, byte[] nonce, byte[]
private void testDrbgReseedWithAdditionalInfo(byte[] entropy, byte[] reseed, byte[] nonce, byte[] perso, byte[] additonalInputReseed, byte[] additonalInput1, byte[] additonalInput2, byte[] expected) {
testDrbgReseed(MacFactory.Default.hmacSha512(), entropy, reseed, nonce, perso, additonalInputReseed, additonalInput1, additonalInput2, expected, DEFAULT_NIST_OUT_LENGTH_BIT);
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/rnd/HmacDrbgTest.java b/src/test/java/at/favre/tools/dice/rnd/HmacDrbgTest.java
index 9a15c90..ddac433 100644
--- a/src/test/java/at/favre/tools/dice/rnd/HmacDrbgTest.java
+++ b/src/test/java/at/favre/tools/dice/rnd/HmacDrbgTest.java
@@ -6,7 +6,12 @@
import org.junit.Test;
import java.security.SecureRandom;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
import static org.junit.Assert.*;
@@ -107,4 +112,4 @@ public void testShouldAutoReseed() {
assertFalse(Arrays.equals(out, out3));
assertFalse(Arrays.equals(out2, out3));
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/rnd/entropy/BCThreadedEntropySourceTest.java b/src/test/java/at/favre/tools/dice/rnd/entropy/BCThreadedEntropySourceTest.java
index 6cbc9b5..03688bf 100644
--- a/src/test/java/at/favre/tools/dice/rnd/entropy/BCThreadedEntropySourceTest.java
+++ b/src/test/java/at/favre/tools/dice/rnd/entropy/BCThreadedEntropySourceTest.java
@@ -28,7 +28,7 @@ public class BCThreadedEntropySourceTest extends AEntropySourceTest {
public void generateEntropy() throws Exception {
BCThreadedEntropySource source = new BCThreadedEntropySource();
- Thread.currentThread().sleep(25);
+ Thread.sleep(25);
byte[] seed = source.generateEntropy(1024);
byte[] seed1 = source.generateEntropy(1024);
@@ -50,4 +50,4 @@ public void generateEntropy() throws Exception {
ExpandableEntropySource getExpandableEntropySource() {
return new BCThreadedEntropySource();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/rnd/entropy/ExternalStrongSeedEntropySourceTest.java b/src/test/java/at/favre/tools/dice/rnd/entropy/ExternalStrongSeedEntropySourceTest.java
index 6166ee8..7eadf9e 100644
--- a/src/test/java/at/favre/tools/dice/rnd/entropy/ExternalStrongSeedEntropySourceTest.java
+++ b/src/test/java/at/favre/tools/dice/rnd/entropy/ExternalStrongSeedEntropySourceTest.java
@@ -23,4 +23,4 @@ public class ExternalStrongSeedEntropySourceTest extends AEntropySourceTest {
ExpandableEntropySource getExpandableEntropySource() {
return new ExternalStrongSeedEntropySource("kas7p2ejkash78d2lasdh8");
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/rnd/entropy/ExternalWeakSeedEntropySourceTest.java b/src/test/java/at/favre/tools/dice/rnd/entropy/ExternalWeakSeedEntropySourceTest.java
index 376ceb3..ff9c096 100644
--- a/src/test/java/at/favre/tools/dice/rnd/entropy/ExternalWeakSeedEntropySourceTest.java
+++ b/src/test/java/at/favre/tools/dice/rnd/entropy/ExternalWeakSeedEntropySourceTest.java
@@ -23,4 +23,4 @@ public class ExternalWeakSeedEntropySourceTest extends AEntropySourceTest {
ExpandableEntropySource getExpandableEntropySource() {
return new ExternalWeakSeedEntropySource("1234");
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/rnd/entropy/HKDFEntropyPoolTest.java b/src/test/java/at/favre/tools/dice/rnd/entropy/HKDFEntropyPoolTest.java
index 3a8383b..19ee1b3 100644
--- a/src/test/java/at/favre/tools/dice/rnd/entropy/HKDFEntropyPoolTest.java
+++ b/src/test/java/at/favre/tools/dice/rnd/entropy/HKDFEntropyPoolTest.java
@@ -45,11 +45,11 @@ public void generateSeed() throws Exception {
Set pastSeeds = new HashSet<>();
for (int i = 8; i < 64; i += 8) {
byte[] seed = entropyPool.generateEntropy(i);
- assertTrue(seed.length == i);
+ assertEquals(seed.length, i);
assertFalse(pastSeeds.contains(seed));
pastSeeds.add(seed);
System.out.println(Bytes.from(seed).encodeHex());
}
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/rnd/entropy/JDKThreadedEntropySourceTest.java b/src/test/java/at/favre/tools/dice/rnd/entropy/JDKThreadedEntropySourceTest.java
index 5fd5d71..8742cc4 100644
--- a/src/test/java/at/favre/tools/dice/rnd/entropy/JDKThreadedEntropySourceTest.java
+++ b/src/test/java/at/favre/tools/dice/rnd/entropy/JDKThreadedEntropySourceTest.java
@@ -24,4 +24,4 @@ public class JDKThreadedEntropySourceTest extends AEntropySourceTest {
ExpandableEntropySource getExpandableEntropySource() {
return new JDKThreadedEntropySource();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/rnd/entropy/NonceEntropySourceTest.java b/src/test/java/at/favre/tools/dice/rnd/entropy/NonceEntropySourceTest.java
index 4b0ba7e..6f7c15b 100644
--- a/src/test/java/at/favre/tools/dice/rnd/entropy/NonceEntropySourceTest.java
+++ b/src/test/java/at/favre/tools/dice/rnd/entropy/NonceEntropySourceTest.java
@@ -24,4 +24,4 @@ public class NonceEntropySourceTest extends AEntropySourceTest {
ExpandableEntropySource getExpandableEntropySource() {
return new NonceEntropySource();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/rnd/entropy/PersonalizationSourceTest.java b/src/test/java/at/favre/tools/dice/rnd/entropy/PersonalizationSourceTest.java
index 125a555..2141a12 100644
--- a/src/test/java/at/favre/tools/dice/rnd/entropy/PersonalizationSourceTest.java
+++ b/src/test/java/at/favre/tools/dice/rnd/entropy/PersonalizationSourceTest.java
@@ -24,4 +24,4 @@ public class PersonalizationSourceTest extends AEntropySourceTest {
ExpandableEntropySource getExpandableEntropySource() {
return new PersonalizationSource();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/rnd/entropy/SecureRandomEntropySourceTest.java b/src/test/java/at/favre/tools/dice/rnd/entropy/SecureRandomEntropySourceTest.java
index fc9f968..917979a 100644
--- a/src/test/java/at/favre/tools/dice/rnd/entropy/SecureRandomEntropySourceTest.java
+++ b/src/test/java/at/favre/tools/dice/rnd/entropy/SecureRandomEntropySourceTest.java
@@ -24,4 +24,4 @@ public class SecureRandomEntropySourceTest extends AEntropySourceTest {
ExpandableEntropySource getExpandableEntropySource() {
return new SecureRandomEntropySource();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/service/anuquantum/AnuQuantumServiceHandlerTest.java b/src/test/java/at/favre/tools/dice/service/anuquantum/AnuQuantumServiceHandlerTest.java
index 88da3e3..e922377 100644
--- a/src/test/java/at/favre/tools/dice/service/anuquantum/AnuQuantumServiceHandlerTest.java
+++ b/src/test/java/at/favre/tools/dice/service/anuquantum/AnuQuantumServiceHandlerTest.java
@@ -35,4 +35,4 @@ public void getRandom() throws Exception {
assertTrue(response.response.size == AnuQuantumServiceHandler.ENTROPY_SEED_LENGTH_BYTE);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/service/hotbits/HotbitsServiceHandlerTest.java b/src/test/java/at/favre/tools/dice/service/hotbits/HotbitsServiceHandlerTest.java
index 160bb93..db416ac 100644
--- a/src/test/java/at/favre/tools/dice/service/hotbits/HotbitsServiceHandlerTest.java
+++ b/src/test/java/at/favre/tools/dice/service/hotbits/HotbitsServiceHandlerTest.java
@@ -21,12 +21,12 @@ public void getRandom() throws Exception {
}
if (response.throwable != null && response.throwable instanceof UnknownHostException) {
- System.out.printf(response.errorMsg);
+ System.out.print(response.errorMsg);
} else {
assertNotNull(response.seed);
assertNull(response.response);
System.out.println(Bytes.from(response.seed).encodeHex());
- assertTrue(response.seed.length == ENTROPY_SEED_LENGTH_BYTE);
+ assertEquals(response.seed.length, ENTROPY_SEED_LENGTH_BYTE);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/service/randomorg/RandomOrgServiceHandlerTest.java b/src/test/java/at/favre/tools/dice/service/randomorg/RandomOrgServiceHandlerTest.java
index 9e5b06f..b776907 100644
--- a/src/test/java/at/favre/tools/dice/service/randomorg/RandomOrgServiceHandlerTest.java
+++ b/src/test/java/at/favre/tools/dice/service/randomorg/RandomOrgServiceHandlerTest.java
@@ -47,7 +47,7 @@ public void testResponseModel() {
assertNotNull(response.toString());
assertNotEquals(0, response.hashCode());
assertEquals(response, response);
- assertNotEquals(new String("muh"), response);
+ assertNotEquals("muh", response);
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/service/randomorg/RandomOrgUtilTest.java b/src/test/java/at/favre/tools/dice/service/randomorg/RandomOrgUtilTest.java
index d522e47..7c9c8f8 100644
--- a/src/test/java/at/favre/tools/dice/service/randomorg/RandomOrgUtilTest.java
+++ b/src/test/java/at/favre/tools/dice/service/randomorg/RandomOrgUtilTest.java
@@ -42,5 +42,4 @@ public void parsePublicKeyAndTestEncrypt() throws Exception {
assertFalse(Arrays.equals(plain, encrypted));
}
-
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/ui/CLIParserTest.java b/src/test/java/at/favre/tools/dice/ui/CLIParserTest.java
index befb45d..e871f4c 100644
--- a/src/test/java/at/favre/tools/dice/ui/CLIParserTest.java
+++ b/src/test/java/at/favre/tools/dice/ui/CLIParserTest.java
@@ -95,4 +95,4 @@ public void testVersion() {
public static String[] asArgArray(String cmd) {
return Commandline.translateCommandline(cmd);
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/ui/ColumnRendererTest.java b/src/test/java/at/favre/tools/dice/ui/ColumnRendererTest.java
index 5213c3f..e1312c5 100644
--- a/src/test/java/at/favre/tools/dice/ui/ColumnRendererTest.java
+++ b/src/test/java/at/favre/tools/dice/ui/ColumnRendererTest.java
@@ -12,6 +12,7 @@
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@@ -31,7 +32,7 @@ public void render() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
new ColumnRenderer(encoderFormat, generator).render(2, new PrintStream(baos), false);
- String out = baos.toString("UTF-8");
+ String out = baos.toString(StandardCharsets.UTF_8);
assertNotNull(out);
assertTrue(out.length() > 10);
}
@@ -60,7 +61,7 @@ public void renderSingleColumn() throws Exception {
public void renderMany() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
new ColumnRenderer(encoderFormat, generator).renderSingleColumn(13, new PrintStream(baos));
- String out = baos.toString("UTF-8");
+ String out = baos.toString(StandardCharsets.UTF_8);
assertNotNull(out);
assertTrue(out.length() > 10);
System.out.println(out);
@@ -76,7 +77,7 @@ private void testRender(ColumnRenderer.RandomGenerator randomGenerator, EncoderF
new ColumnRenderer(encoderFormat, randomGenerator).render(count, new PrintStream(baos), isFile);
}
- String out = baos.toString("UTF-8");
+ String out = baos.toString(StandardCharsets.UTF_8);
assertNotNull(out);
assertTrue(out.length() > 10);
System.out.println(out);
@@ -115,4 +116,4 @@ private List generateRnd(Encoder encoder, int length, int count) {
}
return out;
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/at/favre/tools/dice/util/ByteUtilsTest.java b/src/test/java/at/favre/tools/dice/util/ByteUtilsTest.java
index 0645f79..21d2873 100644
--- a/src/test/java/at/favre/tools/dice/util/ByteUtilsTest.java
+++ b/src/test/java/at/favre/tools/dice/util/ByteUtilsTest.java
@@ -18,4 +18,4 @@ public void appendCrc32Checksum() {
assertEquals(b1.length + 4, b1PlusCrc32.length);
assertFalse(Arrays.equals(b1, b1PlusCrc32));
}
-}
\ No newline at end of file
+}