Skip to content

Commit a7b641f

Browse files
authored
Merge pull request #16 from assaabloy-ppi/master
RemovingBase64 dependency to work with Java 7. Java 7 is a requiremen…
2 parents 2d62c77 + 5bda32a commit a7b641f

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

src/com/iwebpp/crypto/TweetNaclFast.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import java.io.UnsupportedEncodingException;
77
import java.security.SecureRandom;
8-
import java.util.Base64;
98
import java.lang.System;
109
import java.util.concurrent.atomic.AtomicLong;
1110

@@ -3390,16 +3389,6 @@ public static byte[] makeSecretBoxNonce() {
33903389
return randombytes(SecretBox.nonceLength);
33913390
}
33923391

3393-
public static String base64EncodeToString(byte [] b) {
3394-
return Base64.getUrlEncoder().withoutPadding().encodeToString(b);
3395-
}
3396-
// byte[] Base64.getUrlEncoder().withoutPadding().encode(b);
3397-
3398-
public static byte[] base64Decode(String s) {
3399-
return Base64.getUrlDecoder().decode(s);
3400-
}
3401-
// byte[] Base64.getUrlDecoder().decode(byte[] b)
3402-
34033392
public static String hexEncodeToString( byte [] raw ) {
34043393
String HEXES = "0123456789ABCDEF";
34053394
final StringBuilder hex = new StringBuilder( 2 * raw.length );

src/com/iwebpp/crypto/tests/TweetNaclFastTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,13 @@ private boolean testBoxNonce() throws UnsupportedEncodingException {
194194

195195
// explicit nonce
196196
byte [] theNonce = TweetNaclFast.makeBoxNonce();
197-
byte [] theNonce2 = TweetNaclFast.base64Decode(
198-
TweetNaclFast.base64EncodeToString(theNonce));
199-
Log.d(TAG, "BoxNonce Base64 test Equal: " + "\"" + java.util.Arrays.equals(theNonce, theNonce2) + "\"");
200197
byte [] theNonce3 = TweetNaclFast.hexDecode(
201198
TweetNaclFast.hexEncodeToString(theNonce));
202199
Log.d(TAG, "BoxNonce Hex test Equal: " + "\"" + java.util.Arrays.equals(theNonce, theNonce3) + "\"");
203200
String theNoncet = "";
204201
for (int i = 0; i < theNonce.length; i ++)
205202
theNoncet += " "+theNonce[i];
206203
Log.d(TAG, "BoxNonce: "+theNoncet);
207-
Log.d(TAG, "BoxNonce: " + "\"" + TweetNaclFast.base64EncodeToString(theNonce) + "\"");
208204
Log.d(TAG, "BoxNonce: " + "\"" + TweetNaclFast.hexEncodeToString(theNonce) + "\"");
209205

210206

0 commit comments

Comments
 (0)