Skip to content

Commit

Permalink
Released 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexis committed Dec 22, 2018
1 parent 6eb5fbb commit 3b644c5
Show file tree
Hide file tree
Showing 42 changed files with 2,239 additions and 398 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Changelog

## 1.3.1 _(2018-12-22)_

**io.crypto**
- Added _StandardKeyFactories_, _StandardKeyPairGenerators_ and _StandardSignatures_ classes

**io.crypto.StandardCiphers**
- Added the _getAesGcmInstance()_ method

**lang.array.ByteArrays**
- Renamed the _ofHexString()_ method to _ofHexadecimalString()_
- Renamed the _toHexString()_ method to _toHexadecimalString()_

**lang**
- Added the _Comparables_ class

**lang.Strings**
- Added _split()_ methods

**misc.quality.Ensure**
- Added _notNullAndEqualTo()_, _notEqualTo()_, _notNullAndNotEqualTo()_, _notNullAndLowerThan()_,
_notNullAndLowerThanOrEqualTo()_, _notNullAndGreaterThan()_, _notNullAndGreaterThanOrEqualTo()_ and
_notNullAndBetween()_ methods

**util.NullableOptional**
- Added the _orElseThrow()_ method


## 1.3.0 _(2018-11-18)_

**io.bytes**
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ To include and use Javanilla, you need to add the following dependency into your
<dependency>
<groupId>com.github.alexisjehan</groupId>
<artifactId>javanilla</artifactId>
<version>1.3.0</version>
<version>1.3.1</version>
</dependency>
```

Or if you are using _Gradle_:
```xml
dependencies {
compile "com.github.alexisjehan:javanilla:1.3.0"
compile "com.github.alexisjehan:javanilla:1.3.1"
}
```

Expand Down Expand Up @@ -81,7 +81,7 @@ System.out.println(Strings.padLeft("foo", size)); // Prints " foo"
System.out.println(Strings.removeEnd("foo", 'o')); // Prints "fo"
System.out.println(Strings.replaceLast("foo", 'o', 'r')); // Prints "for"
System.out.println(Strings.concatMerge("Once upon a time ...", "... the end")); // Prints "Once upon a time ... the end"
System.out.println(Strings.isHexadecimal(ByteArrays.toHexString("foo".getBytes())) ? "yes" : "no"); // Prints "yes"
System.out.println(Strings.isHexadecimal(ByteArrays.toHexadecimalString("foo".getBytes())) ? "yes" : "no"); // Prints "yes"
final var withPadding = true;
System.out.println(Strings.isBase64(Base64.getEncoder().encodeToString("foo".getBytes()), withPadding) ? "yes" : "no"); // Prints "yes"
```
Expand Down Expand Up @@ -111,11 +111,11 @@ CharArrays.join(separator, CharArrays.of('f', 'o', 'o'), CharArrays.of('b', 'a',
FloatArrays.containsAll(FloatArrays.of(0.0f, 1.0f, 2.0f), 2.0f, 3.0f); // False
FloatArrays.containsAll(FloatArrays.of(1.0f, 2.0f, 3.0f), 2.0f, 3.0f); // True
DoubleArrays.indexOf(DoubleArrays.of(1.0d, 2.0d, 3.0d), 2.0d); // 1
ByteArrays.toHexString(
ByteArrays.toHexadecimalString(
ByteArrays.concat(
ByteArrays.of((byte) 0x00, (byte) 0xff),
ByteArrays.ofDouble(3.14d, ByteOrder.BIG_ENDIAN),
ByteArrays.ofHexString("0xff"),
ByteArrays.ofHexadecimalString("0xff"),
"foo".getBytes()
)
); // 00ff40091eb851eb851fff666f6f
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.github.alexisjehan</groupId>
<artifactId>javanilla</artifactId>
<version>1.3.0-SNAPSHOT</version>
<version>1.3.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Javanilla</name>
Expand Down Expand Up @@ -70,13 +70,13 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.1</version>
<version>5.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.1</version>
<version>5.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ public static Cipher getAesEcbPkcs5Instance() {
return getInstance("AES/ECB/PKCS5Padding");
}

/**
* <p>Get a new "AES/GCM/NoPadding" {@code Cipher} instance.</p>
* @return a "AES/GCM/NoPadding" {@code Cipher} instance
* @since 1.3.1
*/
public static Cipher getAesGcmInstance() {
return getInstance("AES/GCM/NoPadding");
}

/**
* <p>Get a new "DES/CBC/NoPadding" {@code Cipher} instance.</p>
* @return a "DES/CBC/NoPadding" {@code Cipher} instance
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
MIT License
Copyright (c) 2018 Alexis Jehan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.github.alexisjehan.javanilla.crypto;

import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;

/**
* <p>A {@link KeyFactory} factory to get standard instances without throwing checked exceptions.</p>
* @since 1.3.1
*/
public final class StandardKeyFactories {

/**
* <p>Constructor not available.</p>
* @since 1.3.1
*/
private StandardKeyFactories() {
// Not available
}

/**
* <p>Get a new "DiffieHellman" {@code KeyFactory} instance.</p>
* @return a "DiffieHellman" {@code KeyFactory} instance
* @since 1.3.1
*/
public static KeyFactory getDiffieHellmanInstance() {
return getInstance("DiffieHellman");
}

/**
* <p>Get a new "DSA" {@code KeyFactory} instance.</p>
* @return a "DSA" {@code KeyFactory} instance
* @since 1.3.1
*/
public static KeyFactory getDsaInstance() {
return getInstance("DSA");
}

/**
* <p>Get a new "RSA" {@code KeyFactory} instance.</p>
* @return a "RSA" {@code KeyFactory} instance
* @since 1.3.1
*/
public static KeyFactory getRsaInstance() {
return getInstance("RSA");
}

/**
* <p>Get a new {@code KeyFactory} instance without throwing {@code NoSuchAlgorithmException}.</p>
* @param algorithm the {@code KeyFactory} algorithm
* @return a {@code KeyFactory} instance of the provided algorithm
* @since 1.3.1
*/
private static KeyFactory getInstance(final String algorithm) {
try {
return KeyFactory.getInstance(algorithm);
} catch (final NoSuchAlgorithmException e) {
throw new AssertionError(e);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
MIT License
Copyright (c) 2018 Alexis Jehan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.github.alexisjehan.javanilla.crypto;

import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;

/**
* <p>A {@link KeyPairGenerator} factory to get standard instances without throwing checked exceptions.</p>
* @since 1.3.1
*/
public final class StandardKeyPairGenerators {

/**
* <p>Constructor not available.</p>
* @since 1.3.1
*/
private StandardKeyPairGenerators() {
// Not available
}

/**
* <p>Get a new "DiffieHellman" {@code KeyPairGenerator} instance.</p>
* @return a "DiffieHellman" {@code KeyPairGenerator} instance
* @since 1.3.1
*/
public static KeyPairGenerator getDiffieHellmanInstance() {
return getInstance("DiffieHellman");
}

/**
* <p>Get a new "DSA" {@code KeyPairGenerator} instance.</p>
* @return a "DSA" {@code KeyPairGenerator} instance
* @since 1.3.1
*/
public static KeyPairGenerator getDsaInstance() {
return getInstance("DSA");
}

/**
* <p>Get a new "RSA" {@code KeyPairGenerator} instance.</p>
* @return a "RSA" {@code KeyPairGenerator} instance
* @since 1.3.1
*/
public static KeyPairGenerator getRsaInstance() {
return getInstance("RSA");
}

/**
* <p>Get a new {@code KeyPairGenerator} instance without throwing {@code NoSuchAlgorithmException}.</p>
* @param algorithm the {@code KeyPairGenerator} algorithm
* @return a {@code KeyPairGenerator} instance of the provided algorithm
* @since 1.3.1
*/
private static KeyPairGenerator getInstance(final String algorithm) {
try {
return KeyPairGenerator.getInstance(algorithm);
} catch (final NoSuchAlgorithmException e) {
throw new AssertionError(e);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
MIT License
Copyright (c) 2018 Alexis Jehan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
package com.github.alexisjehan.javanilla.crypto;

import java.security.NoSuchAlgorithmException;
import java.security.Signature;

/**
* <p>A {@link Signature} factory to get standard instances without throwing checked exceptions.</p>
* @since 1.3.1
*/
public final class StandardSignatures {

/**
* <p>Constructor not available.</p>
* @since 1.3.1
*/
private StandardSignatures() {
// Not available
}

/**
* <p>Get a new "SHA1withDSA" {@code Signature} instance.</p>
* @return a "SHA1withDSA" {@code Signature} instance
* @since 1.3.1
*/
public static Signature getSha1WithDsaInstance() {
return getInstance("SHA1withDSA");
}

/**
* <p>Get a new "SHA256withDSA" {@code Signature} instance.</p>
* @return a "SHA256withDSA" {@code Signature} instance
* @since 1.3.1
*/
public static Signature getSha256WithDsaInstance() {
return getInstance("SHA256withDSA");
}

/**
* <p>Get a new "SHA1withRSA" {@code Signature} instance.</p>
* @return a "SHA1withRSA" {@code Signature} instance
* @since 1.3.1
*/
public static Signature getSha1WithRsaInstance() {
return getInstance("SHA1withRSA");
}

/**
* <p>Get a new "SHA256withRSA" {@code Signature} instance.</p>
* @return a "SHA256withRSA" {@code Signature} instance
* @since 1.3.1
*/
public static Signature getSha256WithRsaInstance() {
return getInstance("SHA256withRSA");
}

/**
* <p>Get a new {@code Signature} instance without throwing {@code NoSuchAlgorithmException}.</p>
* @param algorithm the {@code Signature} algorithm
* @return a {@code Signature} instance of the provided algorithm
* @since 1.3.1
*/
private static Signature getInstance(final String algorithm) {
try {
return Signature.getInstance(algorithm);
} catch (final NoSuchAlgorithmException e) {
throw new AssertionError(e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public final class SerializationException extends RuntimeException {
* <p>Serial version unique ID.</p>
* @since 1.0.0
*/
private static final long serialVersionUID = -2383288474294867415L;
private static final long serialVersionUID = -7322730015273496724L;

/**
* <p>Constructor with a cause.</p>
Expand Down
Loading

0 comments on commit 3b644c5

Please sign in to comment.