diff --git a/Dorkbox-Util/src/dorkbox/util/MathUtil.java b/Dorkbox-Util/src/dorkbox/util/MathUtil.java index 0853745..e201ef4 100644 --- a/Dorkbox-Util/src/dorkbox/util/MathUtil.java +++ b/Dorkbox-Util/src/dorkbox/util/MathUtil.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package dorkbox.util; diff --git a/Dorkbox-Util/src/dorkbox/util/OSUtil.java b/Dorkbox-Util/src/dorkbox/util/OSUtil.java index efa41b1..30e66c8 100644 --- a/Dorkbox-Util/src/dorkbox/util/OSUtil.java +++ b/Dorkbox-Util/src/dorkbox/util/OSUtil.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package dorkbox.util; import java.io.BufferedReader; diff --git a/Dorkbox-Util/src/dorkbox/util/bytes/UByte.java b/Dorkbox-Util/src/dorkbox/util/bytes/UByte.java index c78ecd0..2c51bc7 100644 --- a/Dorkbox-Util/src/dorkbox/util/bytes/UByte.java +++ b/Dorkbox-Util/src/dorkbox/util/bytes/UByte.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * All rights reserved. * @@ -301,4 +301,4 @@ public final class UByte extends UNumber implements Comparable { public BigInteger toBigInteger() { return BigInteger.valueOf(this.value); } -} \ No newline at end of file +} diff --git a/Dorkbox-Util/src/dorkbox/util/bytes/UInteger.java b/Dorkbox-Util/src/dorkbox/util/bytes/UInteger.java index 52ef91a..8ef1ae8 100644 --- a/Dorkbox-Util/src/dorkbox/util/bytes/UInteger.java +++ b/Dorkbox-Util/src/dorkbox/util/bytes/UInteger.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * All rights reserved. * @@ -331,4 +331,4 @@ public final class UInteger extends UNumber implements Comparable { public int compareTo(UInteger o) { return this.value < o.value ? -1 : this.value == o.value ? 0 : 1; } -} \ No newline at end of file +} diff --git a/Dorkbox-Util/src/dorkbox/util/bytes/ULong.java b/Dorkbox-Util/src/dorkbox/util/bytes/ULong.java index ff19636..3b44af7 100644 --- a/Dorkbox-Util/src/dorkbox/util/bytes/ULong.java +++ b/Dorkbox-Util/src/dorkbox/util/bytes/ULong.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * All rights reserved. * @@ -200,4 +200,4 @@ public final class ULong extends UNumber implements Comparable { public int compareTo(ULong o) { return this.value.compareTo(o.value); } -} \ No newline at end of file +} diff --git a/Dorkbox-Util/src/dorkbox/util/bytes/UNumber.java b/Dorkbox-Util/src/dorkbox/util/bytes/UNumber.java index d0ea59b..3eff999 100644 --- a/Dorkbox-Util/src/dorkbox/util/bytes/UNumber.java +++ b/Dorkbox-Util/src/dorkbox/util/bytes/UNumber.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * All rights reserved. * @@ -61,4 +61,4 @@ public abstract class UNumber extends Number { public BigInteger toBigInteger() { return new BigInteger(toString()); } -} \ No newline at end of file +} diff --git a/Dorkbox-Util/src/dorkbox/util/bytes/UShort.java b/Dorkbox-Util/src/dorkbox/util/bytes/UShort.java index 4175cbd..d23a7e9 100644 --- a/Dorkbox-Util/src/dorkbox/util/bytes/UShort.java +++ b/Dorkbox-Util/src/dorkbox/util/bytes/UShort.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * All rights reserved. * @@ -178,4 +178,4 @@ public final class UShort extends UNumber implements Comparable { public int compareTo(UShort o) { return this.value < o.value ? -1 : this.value == o.value ? 0 : 1; } -} \ No newline at end of file +} diff --git a/Dorkbox-Util/src/dorkbox/util/bytes/Unsigned.java b/Dorkbox-Util/src/dorkbox/util/bytes/Unsigned.java index dbce032..0476e7b 100644 --- a/Dorkbox-Util/src/dorkbox/util/bytes/Unsigned.java +++ b/Dorkbox-Util/src/dorkbox/util/bytes/Unsigned.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * All rights reserved. * @@ -205,4 +205,4 @@ public final class Unsigned { * No instances */ private Unsigned() {} -} \ No newline at end of file +} diff --git a/Dorkbox-Util/src/dorkbox/util/collections/IntArray.java b/Dorkbox-Util/src/dorkbox/util/collections/IntArray.java index 75ad0e9..edc43e6 100644 --- a/Dorkbox-Util/src/dorkbox/util/collections/IntArray.java +++ b/Dorkbox-Util/src/dorkbox/util/collections/IntArray.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,10 +19,10 @@ package dorkbox.util.collections; -import dorkbox.util.MathUtil; - import java.util.Arrays; +import dorkbox.util.MathUtil; + /** A resizable, ordered or unordered int array. Avoids the boxing that occurs with ArrayList. If unordered, this class * avoids a memory copy when removing elements (the last element is moved to the removed element's position). * @author Nathan Sweet */ diff --git a/Dorkbox-Util/src/dorkbox/util/collections/IntMap.java b/Dorkbox-Util/src/dorkbox/util/collections/IntMap.java index b001f85..c358004 100644 --- a/Dorkbox-Util/src/dorkbox/util/collections/IntMap.java +++ b/Dorkbox-Util/src/dorkbox/util/collections/IntMap.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,11 +19,11 @@ package dorkbox.util.collections; -import dorkbox.util.MathUtil; - import java.util.Iterator; import java.util.NoSuchElementException; +import dorkbox.util.MathUtil; + /** An unordered map that uses int keys. This implementation is a cuckoo hash map using 3 hashes, random walking, and a small stash * for problematic keys. Null values are allowed. No allocation is done except when growing the table size.
*
diff --git a/Dorkbox-Util/src/dorkbox/util/collections/ObjectIntMap.java b/Dorkbox-Util/src/dorkbox/util/collections/ObjectIntMap.java index 2e1eb3f..778273d 100644 --- a/Dorkbox-Util/src/dorkbox/util/collections/ObjectIntMap.java +++ b/Dorkbox-Util/src/dorkbox/util/collections/ObjectIntMap.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,6 +16,7 @@ package dorkbox.util.collections; import com.esotericsoftware.kryo.util.ObjectMap; + import dorkbox.util.MathUtil; /** An unordered map where the values are ints. This implementation is a cuckoo hash map using 3 hashes, random walking, and a diff --git a/Dorkbox-Util/src/dorkbox/util/crypto/BCrypt.java b/Dorkbox-Util/src/dorkbox/util/crypto/BCrypt.java index 7d73942..afbbe3f 100644 --- a/Dorkbox-Util/src/dorkbox/util/crypto/BCrypt.java +++ b/Dorkbox-Util/src/dorkbox/util/crypto/BCrypt.java @@ -12,26 +12,25 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * Copyright (c) 2006 Damien Miller + * + * GWT modified version. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package dorkbox.util.crypto; -// Copyright (c) 2006 Damien Miller -// -// GWT modified version. -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - import java.io.UnsupportedEncodingException; import java.security.SecureRandom; import java.util.Arrays; @@ -510,7 +509,8 @@ public class BCrypt { * @param lr an array containing the two 32-bit half blocks * @param off the position in the array of the blocks */ - private final void encipher(int lr[], int off) { + private + void encipher(int lr[], int off) { int i, n, l = lr[off], r = lr[off + 1]; l ^= P[0]; diff --git a/Dorkbox-Util/src/dorkbox/util/swing/ActiveRenderLoop.java b/Dorkbox-Util/src/dorkbox/util/swing/ActiveRenderLoop.java index 26bfa49..afca4ea 100644 --- a/Dorkbox-Util/src/dorkbox/util/swing/ActiveRenderLoop.java +++ b/Dorkbox-Util/src/dorkbox/util/swing/ActiveRenderLoop.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.swing; import java.awt.Graphics; diff --git a/Dorkbox-Util/src/dorkbox/util/swing/NullRepaintManager.java b/Dorkbox-Util/src/dorkbox/util/swing/NullRepaintManager.java index d84964c..c5cc6a8 100644 --- a/Dorkbox-Util/src/dorkbox/util/swing/NullRepaintManager.java +++ b/Dorkbox-Util/src/dorkbox/util/swing/NullRepaintManager.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.swing; import javax.swing.JComponent; diff --git a/Dorkbox-Util/src/dorkbox/util/swing/SwingActiveRender.java b/Dorkbox-Util/src/dorkbox/util/swing/SwingActiveRender.java index 50875ec..9e0bf2c 100644 --- a/Dorkbox-Util/src/dorkbox/util/swing/SwingActiveRender.java +++ b/Dorkbox-Util/src/dorkbox/util/swing/SwingActiveRender.java @@ -1,9 +1,20 @@ +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.swing; -import dorkbox.util.ActionHandlerLong; - -import javax.swing.JComponent; -import javax.swing.JFrame; import java.awt.Component; import java.awt.EventQueue; import java.util.ArrayDeque; @@ -12,6 +23,11 @@ import java.util.Deque; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; +import javax.swing.JComponent; +import javax.swing.JFrame; + +import dorkbox.util.ActionHandlerLong; + /** * Contains all of the appropriate logic to setup and render via "Active" rendering (instead of "Passive" rendering). This permits us to * render JFrames (and their contents), OFF of the EDT - even though there are other frames/components that are ON the EDT.
Because we diff --git a/Dorkbox-Util/src/dorkbox/util/swing/SynchronizedEventQueue.java b/Dorkbox-Util/src/dorkbox/util/swing/SynchronizedEventQueue.java index b08b239..703f510 100644 --- a/Dorkbox-Util/src/dorkbox/util/swing/SynchronizedEventQueue.java +++ b/Dorkbox-Util/src/dorkbox/util/swing/SynchronizedEventQueue.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.swing; import java.awt.AWTEvent; diff --git a/Dorkbox-Util/test/dorkbox/util/Base64FastTest.java b/Dorkbox-Util/test/dorkbox/util/Base64FastTest.java index ac6db29..f8c9889 100644 --- a/Dorkbox-Util/test/dorkbox/util/Base64FastTest.java +++ b/Dorkbox-Util/test/dorkbox/util/Base64FastTest.java @@ -1,6 +1,20 @@ +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util; - import static org.junit.Assert.fail; import java.io.IOException; @@ -25,4 +39,4 @@ public class Base64FastTest { randomData = null; } -} \ No newline at end of file +} diff --git a/Dorkbox-Util/test/dorkbox/util/ByteBuffer2Test.java b/Dorkbox-Util/test/dorkbox/util/ByteBuffer2Test.java index f4a5d91..4f08ddc 100644 --- a/Dorkbox-Util/test/dorkbox/util/ByteBuffer2Test.java +++ b/Dorkbox-Util/test/dorkbox/util/ByteBuffer2Test.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util; import java.lang.reflect.Array; diff --git a/Dorkbox-Util/test/dorkbox/util/MersenneTwisterFastTest.java b/Dorkbox-Util/test/dorkbox/util/MersenneTwisterFastTest.java index 7ce065f..f5e5eeb 100644 --- a/Dorkbox-Util/test/dorkbox/util/MersenneTwisterFastTest.java +++ b/Dorkbox-Util/test/dorkbox/util/MersenneTwisterFastTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util; import java.io.IOException; @@ -236,4 +251,4 @@ public class MersenneTwisterFastTest { } } -} \ No newline at end of file +} diff --git a/Dorkbox-Util/test/dorkbox/util/StorageTest.java b/Dorkbox-Util/test/dorkbox/util/StorageTest.java index 3299486..d08f13f 100644 --- a/Dorkbox-Util/test/dorkbox/util/StorageTest.java +++ b/Dorkbox-Util/test/dorkbox/util/StorageTest.java @@ -1,19 +1,40 @@ +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util; +import java.io.File; +import java.io.IOException; +import java.util.Arrays; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runners.MethodSorters; +import org.slf4j.Logger; + import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryo.Serializer; import com.esotericsoftware.kryo.io.Input; import com.esotericsoftware.kryo.io.Output; + import dorkbox.util.storage.Storage; import dorkbox.util.storage.Store; import io.netty.buffer.ByteBuf; -import org.junit.*; -import org.junit.runners.MethodSorters; -import org.slf4j.Logger; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public diff --git a/Dorkbox-Util/test/dorkbox/util/UByteTest.java b/Dorkbox-Util/test/dorkbox/util/UByteTest.java index 39b0a45..c7f6fb0 100644 --- a/Dorkbox-Util/test/dorkbox/util/UByteTest.java +++ b/Dorkbox-Util/test/dorkbox/util/UByteTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * All rights reserved. * @@ -35,13 +35,20 @@ */ package dorkbox.util; -import dorkbox.util.bytes.UByte; +import static dorkbox.util.bytes.Unsigned.ubyte; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + import org.junit.Test; -import java.io.*; - -import static dorkbox.util.bytes.Unsigned.ubyte; -import static org.junit.Assert.*; +import dorkbox.util.bytes.UByte; public class UByteTest { diff --git a/Dorkbox-Util/test/dorkbox/util/UIntegerTest.java b/Dorkbox-Util/test/dorkbox/util/UIntegerTest.java index 8c69934..9cc502e 100644 --- a/Dorkbox-Util/test/dorkbox/util/UIntegerTest.java +++ b/Dorkbox-Util/test/dorkbox/util/UIntegerTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * All rights reserved. *

@@ -35,13 +35,21 @@ */ package dorkbox.util; -import dorkbox.util.bytes.UInteger; +import static dorkbox.util.bytes.Unsigned.uint; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + import org.junit.Test; -import java.io.*; - -import static dorkbox.util.bytes.Unsigned.uint; -import static org.junit.Assert.*; +import dorkbox.util.bytes.UInteger; public class UIntegerTest { diff --git a/Dorkbox-Util/test/dorkbox/util/UNumberTest.java b/Dorkbox-Util/test/dorkbox/util/UNumberTest.java index ef1c4ac..2494238 100644 --- a/Dorkbox-Util/test/dorkbox/util/UNumberTest.java +++ b/Dorkbox-Util/test/dorkbox/util/UNumberTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * All rights reserved. * @@ -35,20 +35,28 @@ */ package dorkbox.util; -import dorkbox.util.bytes.*; -import org.junit.Test; +import static dorkbox.util.bytes.ULong.MAX_VALUE_LONG; +import static dorkbox.util.bytes.Unsigned.ubyte; +import static dorkbox.util.bytes.Unsigned.uint; +import static dorkbox.util.bytes.Unsigned.ulong; +import static dorkbox.util.bytes.Unsigned.ushort; +import static java.math.BigInteger.ONE; +import static java.util.Arrays.asList; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import java.math.BigInteger; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import static dorkbox.util.bytes.ULong.MAX_VALUE_LONG; -import static dorkbox.util.bytes.Unsigned.*; -import static java.math.BigInteger.ONE; -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import org.junit.Test; + +import dorkbox.util.bytes.UByte; +import dorkbox.util.bytes.UInteger; +import dorkbox.util.bytes.ULong; +import dorkbox.util.bytes.UNumber; +import dorkbox.util.bytes.UShort; /** * @author Lukas Eder diff --git a/Dorkbox-Util/test/dorkbox/util/crypto/AesTest.java b/Dorkbox-Util/test/dorkbox/util/crypto/AesTest.java index 0eff2a9..45eb3b2 100644 --- a/Dorkbox-Util/test/dorkbox/util/crypto/AesTest.java +++ b/Dorkbox-Util/test/dorkbox/util/crypto/AesTest.java @@ -1,12 +1,21 @@ - +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.crypto; - -import org.bouncycastle.crypto.engines.AESFastEngine; -import org.bouncycastle.crypto.modes.CBCBlockCipher; -import org.bouncycastle.crypto.modes.GCMBlockCipher; -import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher; -import org.junit.Test; +import static org.junit.Assert.fail; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -14,7 +23,11 @@ import java.io.IOException; import java.security.SecureRandom; import java.util.Arrays; -import static org.junit.Assert.fail; +import org.bouncycastle.crypto.engines.AESFastEngine; +import org.bouncycastle.crypto.modes.CBCBlockCipher; +import org.bouncycastle.crypto.modes.GCMBlockCipher; +import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher; +import org.junit.Test; public class AesTest { diff --git a/Dorkbox-Util/test/dorkbox/util/crypto/DsaTest.java b/Dorkbox-Util/test/dorkbox/util/crypto/DsaTest.java index ea62e3c..de94f31 100644 --- a/Dorkbox-Util/test/dorkbox/util/crypto/DsaTest.java +++ b/Dorkbox-Util/test/dorkbox/util/crypto/DsaTest.java @@ -1,8 +1,20 @@ - +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.crypto; - - import static org.junit.Assert.fail; import java.io.IOException; diff --git a/Dorkbox-Util/test/dorkbox/util/crypto/EccTest.java b/Dorkbox-Util/test/dorkbox/util/crypto/EccTest.java index e00bb1f..9c3cb00 100644 --- a/Dorkbox-Util/test/dorkbox/util/crypto/EccTest.java +++ b/Dorkbox-Util/test/dorkbox/util/crypto/EccTest.java @@ -1,14 +1,29 @@ - +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.crypto; +import static org.junit.Assert.fail; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.math.BigInteger; +import java.security.SecureRandom; +import java.util.Arrays; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; -import dorkbox.util.serialization.EccPrivateKeySerializer; -import dorkbox.util.serialization.EccPublicKeySerializer; -import dorkbox.util.serialization.IesParametersSerializer; -import dorkbox.util.serialization.IesWithCipherParametersSerializer; import org.bouncycastle.crypto.AsymmetricCipherKeyPair; import org.bouncycastle.crypto.BasicAgreement; import org.bouncycastle.crypto.CipherParameters; @@ -17,7 +32,11 @@ import org.bouncycastle.crypto.engines.AESFastEngine; import org.bouncycastle.crypto.engines.IESEngine; import org.bouncycastle.crypto.modes.CBCBlockCipher; import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher; -import org.bouncycastle.crypto.params.*; +import org.bouncycastle.crypto.params.ECPrivateKeyParameters; +import org.bouncycastle.crypto.params.ECPublicKeyParameters; +import org.bouncycastle.crypto.params.IESParameters; +import org.bouncycastle.crypto.params.IESWithCipherParameters; +import org.bouncycastle.crypto.params.ParametersWithRandom; import org.bouncycastle.crypto.signers.ECDSASigner; import org.bouncycastle.crypto.util.PrivateKeyFactory; import org.bouncycastle.crypto.util.PublicKeyFactory; @@ -28,14 +47,14 @@ import org.bouncycastle.jce.spec.ECParameterSpec; import org.bouncycastle.util.encoders.Hex; import org.junit.Test; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.math.BigInteger; -import java.security.SecureRandom; -import java.util.Arrays; +import com.esotericsoftware.kryo.Kryo; +import com.esotericsoftware.kryo.io.Input; +import com.esotericsoftware.kryo.io.Output; -import static org.junit.Assert.fail; +import dorkbox.util.serialization.EccPrivateKeySerializer; +import dorkbox.util.serialization.EccPublicKeySerializer; +import dorkbox.util.serialization.IesParametersSerializer; +import dorkbox.util.serialization.IesWithCipherParametersSerializer; public class EccTest { diff --git a/Dorkbox-Util/test/dorkbox/util/crypto/PerformanceTest.java b/Dorkbox-Util/test/dorkbox/util/crypto/PerformanceTest.java index d79d8d2..7c47791 100644 --- a/Dorkbox-Util/test/dorkbox/util/crypto/PerformanceTest.java +++ b/Dorkbox-Util/test/dorkbox/util/crypto/PerformanceTest.java @@ -1,14 +1,29 @@ +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.crypto; +import java.security.SecureRandom; +import java.util.Random; + import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.crypto.engines.AESFastEngine; import org.bouncycastle.crypto.modes.GCMBlockCipher; import org.bouncycastle.crypto.params.KeyParameter; import org.bouncycastle.crypto.params.ParametersWithIV; -import java.security.SecureRandom; -import java.util.Random; - // See: https://stackoverflow.com/questions/25992131/slow-aes-gcm-encryption-and-decryption-with-java-8u20 // java8 performance is 3 MB/s. BC is ~43 MB/s diff --git a/Dorkbox-Util/test/dorkbox/util/crypto/RsaTest.java b/Dorkbox-Util/test/dorkbox/util/crypto/RsaTest.java index 884febd..cc80503 100644 --- a/Dorkbox-Util/test/dorkbox/util/crypto/RsaTest.java +++ b/Dorkbox-Util/test/dorkbox/util/crypto/RsaTest.java @@ -1,12 +1,30 @@ - +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.crypto; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; -import dorkbox.util.serialization.RsaPrivateKeySerializer; -import dorkbox.util.serialization.RsaPublicKeySerializer; +import static org.junit.Assert.fail; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.math.BigInteger; +import java.security.SecureRandom; +import java.util.Arrays; + import org.bouncycastle.crypto.AsymmetricCipherKeyPair; import org.bouncycastle.crypto.digests.SHA1Digest; import org.bouncycastle.crypto.encodings.OAEPEncoding; @@ -18,14 +36,12 @@ import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters; import org.bouncycastle.crypto.signers.PSSSigner; import org.junit.Test; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.math.BigInteger; -import java.security.SecureRandom; -import java.util.Arrays; +import com.esotericsoftware.kryo.Kryo; +import com.esotericsoftware.kryo.io.Input; +import com.esotericsoftware.kryo.io.Output; -import static org.junit.Assert.fail; +import dorkbox.util.serialization.RsaPrivateKeySerializer; +import dorkbox.util.serialization.RsaPublicKeySerializer; public class RsaTest { diff --git a/Dorkbox-Util/test/dorkbox/util/crypto/SCryptTest.java b/Dorkbox-Util/test/dorkbox/util/crypto/SCryptTest.java index ade2527..7168663 100644 --- a/Dorkbox-Util/test/dorkbox/util/crypto/SCryptTest.java +++ b/Dorkbox-Util/test/dorkbox/util/crypto/SCryptTest.java @@ -1,8 +1,20 @@ - +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.crypto; - - import static org.junit.Assert.assertEquals; import java.io.IOException; diff --git a/Dorkbox-Util/test/dorkbox/util/crypto/x509Test.java b/Dorkbox-Util/test/dorkbox/util/crypto/x509Test.java index d213f2d..d31b93c 100644 --- a/Dorkbox-Util/test/dorkbox/util/crypto/x509Test.java +++ b/Dorkbox-Util/test/dorkbox/util/crypto/x509Test.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package dorkbox.util.crypto; import static org.junit.Assert.fail;