Updated copyright

This commit is contained in:
nathan 2017-02-10 00:15:54 +01:00
parent 2d83a4c16d
commit de4d23434d
30 changed files with 370 additions and 120 deletions

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.util; package dorkbox.util;

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package dorkbox.util; package dorkbox.util;
import java.io.BufferedReader; import java.io.BufferedReader;

View File

@ -1,4 +1,4 @@
/** /*
* Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com
* All rights reserved. * All rights reserved.
* *
@ -301,4 +301,4 @@ public final class UByte extends UNumber implements Comparable<UByte> {
public BigInteger toBigInteger() { public BigInteger toBigInteger() {
return BigInteger.valueOf(this.value); return BigInteger.valueOf(this.value);
} }
} }

View File

@ -1,4 +1,4 @@
/** /*
* Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com
* All rights reserved. * All rights reserved.
* *
@ -331,4 +331,4 @@ public final class UInteger extends UNumber implements Comparable<UInteger> {
public int compareTo(UInteger o) { public int compareTo(UInteger o) {
return this.value < o.value ? -1 : this.value == o.value ? 0 : 1; return this.value < o.value ? -1 : this.value == o.value ? 0 : 1;
} }
} }

View File

@ -1,4 +1,4 @@
/** /*
* Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com
* All rights reserved. * All rights reserved.
* *
@ -200,4 +200,4 @@ public final class ULong extends UNumber implements Comparable<ULong> {
public int compareTo(ULong o) { public int compareTo(ULong o) {
return this.value.compareTo(o.value); return this.value.compareTo(o.value);
} }
} }

View File

@ -1,4 +1,4 @@
/** /*
* Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com
* All rights reserved. * All rights reserved.
* *
@ -61,4 +61,4 @@ public abstract class UNumber extends Number {
public BigInteger toBigInteger() { public BigInteger toBigInteger() {
return new BigInteger(toString()); return new BigInteger(toString());
} }
} }

View File

@ -1,4 +1,4 @@
/** /*
* Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com
* All rights reserved. * All rights reserved.
* *
@ -178,4 +178,4 @@ public final class UShort extends UNumber implements Comparable<UShort> {
public int compareTo(UShort o) { public int compareTo(UShort o) {
return this.value < o.value ? -1 : this.value == o.value ? 0 : 1; return this.value < o.value ? -1 : this.value == o.value ? 0 : 1;
} }
} }

View File

@ -1,4 +1,4 @@
/** /*
* Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com
* All rights reserved. * All rights reserved.
* *
@ -205,4 +205,4 @@ public final class Unsigned {
* No instances * No instances
*/ */
private Unsigned() {} private Unsigned() {}
} }

View File

@ -1,4 +1,4 @@
/******************************************************************************* /*
* Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com) * Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -19,10 +19,10 @@
package dorkbox.util.collections; package dorkbox.util.collections;
import dorkbox.util.MathUtil;
import java.util.Arrays; import java.util.Arrays;
import dorkbox.util.MathUtil;
/** A resizable, ordered or unordered int array. Avoids the boxing that occurs with ArrayList<Integer>. If unordered, this class /** A resizable, ordered or unordered int array. Avoids the boxing that occurs with ArrayList<Integer>. If unordered, this class
* avoids a memory copy when removing elements (the last element is moved to the removed element's position). * avoids a memory copy when removing elements (the last element is moved to the removed element's position).
* @author Nathan Sweet */ * @author Nathan Sweet */

View File

@ -1,4 +1,4 @@
/******************************************************************************* /*
* Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com) * Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -19,11 +19,11 @@
package dorkbox.util.collections; package dorkbox.util.collections;
import dorkbox.util.MathUtil;
import java.util.Iterator; import java.util.Iterator;
import java.util.NoSuchElementException; 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 /** 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. <br> * for problematic keys. Null values are allowed. No allocation is done except when growing the table size. <br>
* <br> * <br>

View File

@ -1,4 +1,4 @@
/******************************************************************************* /*
* Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com) * Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -16,6 +16,7 @@
package dorkbox.util.collections; package dorkbox.util.collections;
import com.esotericsoftware.kryo.util.ObjectMap; import com.esotericsoftware.kryo.util.ObjectMap;
import dorkbox.util.MathUtil; 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 /** An unordered map where the values are ints. This implementation is a cuckoo hash map using 3 hashes, random walking, and a

View File

@ -12,26 +12,25 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
* Copyright (c) 2006 Damien Miller <djm@mindrot.org>
*
* 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; package dorkbox.util.crypto;
// Copyright (c) 2006 Damien Miller <djm@mindrot.org>
//
// 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.io.UnsupportedEncodingException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.Arrays; import java.util.Arrays;
@ -510,7 +509,8 @@ public class BCrypt {
* @param lr an array containing the two 32-bit half blocks * @param lr an array containing the two 32-bit half blocks
* @param off the position in the array of the 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]; int i, n, l = lr[off], r = lr[off + 1];
l ^= P[0]; l ^= P[0];

View File

@ -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; package dorkbox.util.swing;
import java.awt.Graphics; import java.awt.Graphics;

View File

@ -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; package dorkbox.util.swing;
import javax.swing.JComponent; import javax.swing.JComponent;

View File

@ -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; package dorkbox.util.swing;
import dorkbox.util.ActionHandlerLong;
import javax.swing.JComponent;
import javax.swing.JFrame;
import java.awt.Component; import java.awt.Component;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.util.ArrayDeque; import java.util.ArrayDeque;
@ -12,6 +23,11 @@ import java.util.Deque;
import java.util.List; import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList; 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 * 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. <br> Because we * render JFrames (and their contents), OFF of the EDT - even though there are other frames/components that are ON the EDT. <br> Because we

View File

@ -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; package dorkbox.util.swing;
import java.awt.AWTEvent; import java.awt.AWTEvent;

View File

@ -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; package dorkbox.util;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.IOException; import java.io.IOException;
@ -25,4 +39,4 @@ public class Base64FastTest {
randomData = null; randomData = null;
} }
} }

View File

@ -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; package dorkbox.util;
import java.lang.reflect.Array; import java.lang.reflect.Array;

View File

@ -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; package dorkbox.util;
import java.io.IOException; import java.io.IOException;
@ -236,4 +251,4 @@ public class MersenneTwisterFastTest {
} }
} }
} }

View File

@ -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; 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.Kryo;
import com.esotericsoftware.kryo.Serializer; import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.io.Input; import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output; import com.esotericsoftware.kryo.io.Output;
import dorkbox.util.storage.Storage; import dorkbox.util.storage.Storage;
import dorkbox.util.storage.Store; import dorkbox.util.storage.Store;
import io.netty.buffer.ByteBuf; 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) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
public public

View File

@ -1,4 +1,4 @@
/** /*
* Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com
* All rights reserved. * All rights reserved.
* *
@ -35,13 +35,20 @@
*/ */
package dorkbox.util; 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 org.junit.Test;
import java.io.*; import dorkbox.util.bytes.UByte;
import static dorkbox.util.bytes.Unsigned.ubyte;
import static org.junit.Assert.*;
public class UByteTest { public class UByteTest {

View File

@ -1,4 +1,4 @@
/** /*
* Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com
* All rights reserved. * All rights reserved.
* <p/> * <p/>
@ -35,13 +35,21 @@
*/ */
package dorkbox.util; 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 org.junit.Test;
import java.io.*; import dorkbox.util.bytes.UInteger;
import static dorkbox.util.bytes.Unsigned.uint;
import static org.junit.Assert.*;
public public
class UIntegerTest { class UIntegerTest {

View File

@ -1,4 +1,4 @@
/** /*
* Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com * Copyright (c) 2011-2013, Lukas Eder, lukas.eder@gmail.com
* All rights reserved. * All rights reserved.
* *
@ -35,20 +35,28 @@
*/ */
package dorkbox.util; package dorkbox.util;
import dorkbox.util.bytes.*; import static dorkbox.util.bytes.ULong.MAX_VALUE_LONG;
import org.junit.Test; 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.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import static dorkbox.util.bytes.ULong.MAX_VALUE_LONG; import org.junit.Test;
import static dorkbox.util.bytes.Unsigned.*;
import static java.math.BigInteger.ONE; import dorkbox.util.bytes.UByte;
import static java.util.Arrays.asList; import dorkbox.util.bytes.UInteger;
import static org.junit.Assert.assertEquals; import dorkbox.util.bytes.ULong;
import static org.junit.Assert.assertFalse; import dorkbox.util.bytes.UNumber;
import dorkbox.util.bytes.UShort;
/** /**
* @author Lukas Eder * @author Lukas Eder

View File

@ -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; package dorkbox.util.crypto;
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;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -14,7 +23,11 @@ import java.io.IOException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.Arrays; 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 { public class AesTest {

View File

@ -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; package dorkbox.util.crypto;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.IOException; import java.io.IOException;

View File

@ -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; 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.AsymmetricCipherKeyPair;
import org.bouncycastle.crypto.BasicAgreement; import org.bouncycastle.crypto.BasicAgreement;
import org.bouncycastle.crypto.CipherParameters; 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.engines.IESEngine;
import org.bouncycastle.crypto.modes.CBCBlockCipher; import org.bouncycastle.crypto.modes.CBCBlockCipher;
import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher; 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.signers.ECDSASigner;
import org.bouncycastle.crypto.util.PrivateKeyFactory; import org.bouncycastle.crypto.util.PrivateKeyFactory;
import org.bouncycastle.crypto.util.PublicKeyFactory; import org.bouncycastle.crypto.util.PublicKeyFactory;
@ -28,14 +47,14 @@ import org.bouncycastle.jce.spec.ECParameterSpec;
import org.bouncycastle.util.encoders.Hex; import org.bouncycastle.util.encoders.Hex;
import org.junit.Test; import org.junit.Test;
import java.io.ByteArrayInputStream; import com.esotericsoftware.kryo.Kryo;
import java.io.ByteArrayOutputStream; import com.esotericsoftware.kryo.io.Input;
import java.io.IOException; import com.esotericsoftware.kryo.io.Output;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.Arrays;
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 { public class EccTest {

View File

@ -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; package dorkbox.util.crypto;
import java.security.SecureRandom;
import java.util.Random;
import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.crypto.CipherParameters;
import org.bouncycastle.crypto.engines.AESFastEngine; import org.bouncycastle.crypto.engines.AESFastEngine;
import org.bouncycastle.crypto.modes.GCMBlockCipher; import org.bouncycastle.crypto.modes.GCMBlockCipher;
import org.bouncycastle.crypto.params.KeyParameter; import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.params.ParametersWithIV; 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 // 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 // java8 performance is 3 MB/s. BC is ~43 MB/s

View File

@ -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; package dorkbox.util.crypto;
import com.esotericsoftware.kryo.Kryo; import static org.junit.Assert.fail;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output; import java.io.ByteArrayInputStream;
import dorkbox.util.serialization.RsaPrivateKeySerializer; import java.io.ByteArrayOutputStream;
import dorkbox.util.serialization.RsaPublicKeySerializer; 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.AsymmetricCipherKeyPair;
import org.bouncycastle.crypto.digests.SHA1Digest; import org.bouncycastle.crypto.digests.SHA1Digest;
import org.bouncycastle.crypto.encodings.OAEPEncoding; import org.bouncycastle.crypto.encodings.OAEPEncoding;
@ -18,14 +36,12 @@ import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters;
import org.bouncycastle.crypto.signers.PSSSigner; import org.bouncycastle.crypto.signers.PSSSigner;
import org.junit.Test; import org.junit.Test;
import java.io.ByteArrayInputStream; import com.esotericsoftware.kryo.Kryo;
import java.io.ByteArrayOutputStream; import com.esotericsoftware.kryo.io.Input;
import java.io.IOException; import com.esotericsoftware.kryo.io.Output;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.Arrays;
import static org.junit.Assert.fail; import dorkbox.util.serialization.RsaPrivateKeySerializer;
import dorkbox.util.serialization.RsaPublicKeySerializer;
public class RsaTest { public class RsaTest {

View File

@ -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; package dorkbox.util.crypto;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import java.io.IOException; import java.io.IOException;

View File

@ -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; package dorkbox.util.crypto;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;