1
0
Fork 0

added other files

This commit is contained in:
Sangbum Kim 2016-10-10 00:43:23 +09:00
parent 79c01be5a6
commit 9b5e3eafb6
8 changed files with 752 additions and 0 deletions

16
build.gradle Normal file
View File

@ -0,0 +1,16 @@
apply plugin: 'java'
apply plugin: 'application'
repositories {
mavenLocal()
jcenter()
maven { url 'http://repo.spring.io/snapshot' }
maven { url 'http://repo.spring.io/milestone' }
maven { url 'http://repo.spring.io/plugins-release' }
}
dependencies{
compile group: 'org.bouncycastle:bcprov-jdk15on:1.54'
}

View File

@ -0,0 +1,6 @@
#Mon Aug 01 04:55:26 KST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-bin.zip

160
gradlew vendored Executable file
View File

@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
gradlew.bat vendored Normal file
View File

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

243
src/main/java/Base64.java Normal file
View File

@ -0,0 +1,243 @@
/**
* A Base64 encoder/decoder.
* <p>
* <p>
* This class is used to encode and decode data in Base64 format as described in RFC 1521.
* <p>
* <p>
* Project home page: <a href="http://www.source-code.biz/base64coder/java/">www. source-code.biz/base64coder/java</a><br>
* Author: Christian d'Heureuse, Inventec Informatik AG, Zurich, Switzerland<br>
* Multi-licensed: EPL / LGPL / AL / BSD.
*/
public class Base64 {
// The line separator string of the operating system.
private static final String systemLineSeparator = System.getProperty("line.separator");
// Mapping table from 6-bit nibbles to Base64 characters.
private static char[] map1 = new char[64];
// Mapping table from Base64 characters to 6-bit nibbles.
private static byte[] map2 = new byte[128];
static {
int i = 0;
for (char c = 'A'; c <= 'Z'; c++)
map1[i++] = c;
for (char c = 'a'; c <= 'z'; c++)
map1[i++] = c;
for (char c = '0'; c <= '9'; c++)
map1[i++] = c;
map1[i++] = '+';
map1[i++] = '/';
}
static {
for (int i = 0; i < map2.length; i++)
map2[i] = -1;
for (int i = 0; i < 64; i++)
map2[map1[i]] = (byte) i;
}
// Dummy constructor.
private Base64() {
}
/**
* Encodes a string into Base64 format. No blanks or line breaks are inserted.
*
* @param s A String to be encoded.
* @return A String containing the Base64 encoded data.
*/
public static String encodeString(String s) {
return new String(encode(s.getBytes()));
}
/**
* Encodes a byte array into Base 64 format and breaks the output into lines of 76 characters. This method is compatible with
* <code>sun.misc.BASE64Encoder.encodeBuffer(byte[])</code>.
*
* @param in An array containing the data bytes to be encoded.
* @return A String containing the Base64 encoded data, broken into lines.
*/
public static String encodeLines(byte[] in) {
return encodeLines(in, 0, in.length, 76, systemLineSeparator);
}
/**
* Encodes a byte array into Base 64 format and breaks the output into lines.
*
* @param in An array containing the data bytes to be encoded.
* @param iOff Offset of the first byte in <code>in</code> to be processed.
* @param iLen Number of bytes to be processed in <code>in</code>, starting at <code>iOff</code>.
* @param lineLen Line length for the output data. Should be a multiple of 4.
* @param lineSeparator The line separator to be used to separate the output lines.
* @return A String containing the Base64 encoded data, broken into lines.
*/
public static String encodeLines(byte[] in, int iOff, int iLen, int lineLen, String lineSeparator) {
int blockLen = (lineLen * 3) / 4;
if (blockLen <= 0)
throw new IllegalArgumentException();
int lines = (iLen + blockLen - 1) / blockLen;
int bufLen = ((iLen + 2) / 3) * 4 + lines * lineSeparator.length();
StringBuilder buf = new StringBuilder(bufLen);
int ip = 0;
while (ip < iLen) {
int l = Math.min(iLen - ip, blockLen);
buf.append(encode(in, iOff + ip, l));
buf.append(lineSeparator);
ip += l;
}
return buf.toString();
}
/**
* Encodes a byte array into Base64 format. No blanks or line breaks are inserted in the output.
*
* @param in An array containing the data bytes to be encoded.
* @return A character array containing the Base64 encoded data.
*/
public static char[] encode(byte[] in) {
return encode(in, 0, in.length);
}
/**
* Encodes a byte array into Base64 format. No blanks or line breaks are inserted in the output.
*
* @param in An array containing the data bytes to be encoded.
* @param iLen Number of bytes to process in <code>in</code>.
* @return A character array containing the Base64 encoded data.
*/
public static char[] encode(byte[] in, int iLen) {
return encode(in, 0, iLen);
}
/**
* Encodes a byte array into Base64 format. No blanks or line breaks are inserted in the output.
*
* @param in An array containing the data bytes to be encoded.
* @param iOff Offset of the first byte in <code>in</code> to be processed.
* @param iLen Number of bytes to process in <code>in</code>, starting at <code>iOff</code>.
* @return A character array containing the Base64 encoded data.
*/
public static char[] encode(byte[] in, int iOff, int iLen) {
int oDataLen = (iLen * 4 + 2) / 3; // output length without padding
int oLen = ((iLen + 2) / 3) * 4; // output length including padding
char[] out = new char[oLen];
int ip = iOff;
int iEnd = iOff + iLen;
int op = 0;
while (ip < iEnd) {
int i0 = in[ip++] & 0xff;
int i1 = ip < iEnd ? in[ip++] & 0xff : 0;
int i2 = ip < iEnd ? in[ip++] & 0xff : 0;
int o0 = i0 >>> 2;
int o1 = ((i0 & 3) << 4) | (i1 >>> 4);
int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6);
int o3 = i2 & 0x3F;
out[op++] = map1[o0];
out[op++] = map1[o1];
out[op] = op < oDataLen ? map1[o2] : '=';
op++;
out[op] = op < oDataLen ? map1[o3] : '=';
op++;
}
return out;
}
/**
* Decodes a string from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.
*
* @param s A Base64 String to be decoded.
* @return A String containing the decoded data.
* @throws IllegalArgumentException If the input is not valid Base64 encoded data.
*/
public static String decodeString(String s) {
return new String(decode(s));
}
/**
* Decodes a byte array from Base64 format and ignores line separators, tabs and blanks. CR, LF, Tab and Space characters are ignored in the input data.
* This method is compatible with <code>sun.misc.BASE64Decoder.decodeBuffer(String)</code>.
*
* @param s A Base64 String to be decoded.
* @return An array containing the decoded data bytes.
* @throws IllegalArgumentException If the input is not valid Base64 encoded data.
*/
public static byte[] decodeLines(String s) {
char[] buf = new char[s.length()];
int p = 0;
for (int ip = 0; ip < s.length(); ip++) {
char c = s.charAt(ip);
if (c != ' ' && c != '\r' && c != '\n' && c != '\t')
buf[p++] = c;
}
return decode(buf, 0, p);
}
/**
* Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.
*
* @param s A Base64 String to be decoded.
* @return An array containing the decoded data bytes.
* @throws IllegalArgumentException If the input is not valid Base64 encoded data.
*/
public static byte[] decode(String s) {
return decode(s.toCharArray());
}
/**
* Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.
*
* @param in A character array containing the Base64 encoded data.
* @return An array containing the decoded data bytes.
* @throws IllegalArgumentException If the input is not valid Base64 encoded data.
*/
public static byte[] decode(char[] in) {
return decode(in, 0, in.length);
}
/**
* Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.
*
* @param in A character array containing the Base64 encoded data.
* @param iOff Offset of the first character in <code>in</code> to be processed.
* @param iLen Number of characters to process in <code>in</code>, starting at <code>iOff</code>.
* @return An array containing the decoded data bytes.
* @throws IllegalArgumentException If the input is not valid Base64 encoded data.
*/
public static byte[] decode(char[] in, int iOff, int iLen) {
if (iLen % 4 != 0)
throw new IllegalArgumentException("Length of Base64 encoded input string is not a multiple of 4.");
while (iLen > 0 && in[iOff + iLen - 1] == '=')
iLen--;
int oLen = (iLen * 3) / 4;
byte[] out = new byte[oLen];
int ip = iOff;
int iEnd = iOff + iLen;
int op = 0;
while (ip < iEnd) {
int i0 = in[ip++];
int i1 = in[ip++];
int i2 = ip < iEnd ? in[ip++] : 'A';
int i3 = ip < iEnd ? in[ip++] : 'A';
if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127)
throw new IllegalArgumentException("Illegal character in Base64 encoded data.");
int b0 = map2[i0];
int b1 = map2[i1];
int b2 = map2[i2];
int b3 = map2[i3];
if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0)
throw new IllegalArgumentException("Illegal character in Base64 encoded data.");
int o0 = (b0 << 2) | (b1 >>> 4);
int o1 = ((b1 & 0xf) << 4) | (b2 >>> 2);
int o2 = ((b2 & 3) << 6) | b3;
out[op++] = (byte) o0;
if (op < oLen)
out[op++] = (byte) o1;
if (op < oLen)
out[op++] = (byte) o2;
}
return out;
}
} // end class Base64Coder

View File

@ -0,0 +1,18 @@
public class Obfuscator {
private SimpleEncryptor encryptor;
private SimpleObfuscator obfuscator;
public Obfuscator(byte[] salt, byte[] key) {
encryptor = new SimpleEncryptor(salt);
obfuscator = new SimpleObfuscator(key);
}
public byte[] obfuscate(byte[] source) {
return encryptor.encrypt(obfuscator.obfuscate(source));
}
public byte[] unobfuscate(byte[] source) {
return obfuscator.unobfuscate(encryptor.decrypt(source));
}
}

View File

@ -0,0 +1,112 @@
import org.bouncycastle.crypto.digests.SHA256Digest;
import org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator;
import org.bouncycastle.crypto.params.KeyParameter;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.Charset;
import java.security.GeneralSecurityException;
import java.security.spec.KeySpec;
public class SimpleEncryptor {
public static final String DEFAULT_CIPHER_ALGORITHM = "AES/CBC/PKCS5Padding";
private static final Charset characterSetUtf8 = Charset.forName("UTF-8");
private static final Charset characterSetAscii = Charset.forName("US-ASCII");
private static final byte[] IV = {10, 2, 3, -4, 20, 23, 47, -38, 27, -22, 14, -20, -22, 37, 36, 54};
private static final byte[] KeyValue = new byte[]{82, 26, -72, 65, -36, 122, -35, 0, -87, 41 - 39, 42, 27, 44, 6 - 97, 86, -36, 124, 115, 82, -97, 115, -85, 40, 107, -17, 120, -10, -107, 13, -48};
private Cipher encryptor;
private Cipher decryptor;
public SimpleEncryptor(byte[] salt) {
this(DEFAULT_CIPHER_ALGORITHM, IV, KeyValue, salt);
}
public SimpleEncryptor(byte[] IV, byte[] keyValue, byte[] salt) {
this(DEFAULT_CIPHER_ALGORITHM, IV, keyValue, salt);
}
public SimpleEncryptor(String cipherAlgorithm, byte[] IV, byte[] keyValue, byte[] salt) {
try {
// SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
// KeySpec keySpec = new PBEKeySpec(new String(keyValue, characterSetAscii).toCharArray(), salt, 2, 256);
// SecretKey tmp = factory.generateSecret(keySpec);
//
//
//PBKDF2WithHmacSHA256
final PKCS5S2ParametersGenerator gen = new PKCS5S2ParametersGenerator(new SHA256Digest());
gen.init(keyValue, salt, 2);
final byte[] dk = ((KeyParameter) gen.generateDerivedParameters(256)).getKey();
SecretKey secret = new SecretKeySpec(dk, "AES");
encryptor = Cipher.getInstance(cipherAlgorithm);
encryptor.init(Cipher.ENCRYPT_MODE, secret, new IvParameterSpec(IV));
decryptor = Cipher.getInstance(cipherAlgorithm);
decryptor.init(Cipher.DECRYPT_MODE, secret, new IvParameterSpec(IV));
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
}
}
public byte[] encrypt(byte[] source) {
if (source == null) {
return null;
}
try {
return encryptor.doFinal(source);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public byte[] decrypt(byte[] source) {
if (source == null) {
return null;
}
try {
return decryptor.doFinal(source);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public String encrypt(String source) {
if (source == null) {
return null;
}
try {
return new String(Base64.encode(encryptor.doFinal(source.getBytes(characterSetAscii))));
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public String decrypt(String source) {
if (source == null) {
return null;
}
try {
return new String(decryptor.doFinal(Base64.decode(source)), characterSetUtf8);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}

View File

@ -0,0 +1,107 @@
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
public class SimpleObfuscator {
private final byte[] key;
public static final byte[] OBFUSCATE_SALT = {-79, -62, 15, -19, -48, -45, -36, 8, 0, -28, -72, 35, 14, -126, 49, -97};
public static final byte[] ENCRYPT_SALT = {-78, 117, 95, 10, -79, 93, 115, 51, -5, -46, 75, -32, 47, -90, 39, 39};
public SimpleObfuscator(byte[] key) {
this.key = key;
}
public byte[] unobfuscate(byte[] s) {
return xorByte(s);
}
public byte[] obfuscate(byte[] s) {
return xorByte(s);
}
private byte[] xorByte(byte[] message) {
try {
if (message == null || key == null)
return null;
int ml = message.length;
int kl = key.length;
ByteBuffer byteBuf = ByteBuffer.allocate(ml);
byteBuf.clear();
for (int i = 0; i < ml; i++) {
byteBuf.put((byte) (message[i] ^ key[i % kl]));
}// for i
byteBuf.flip();
return byteBuf.array();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static void main(String[] args) {
Obfuscator soe = new Obfuscator(OBFUSCATE_SALT, ENCRYPT_SALT);
StringBuffer log = new StringBuffer();
Charset characterSet = Charset.forName("US-ASCII");
//sslpins
// String[] keys={
// "sha256/SlNzY+e3VjHNRXeCxFsG74HzSkjeZ3jbqoSYCD+nBcE=",
// "sha256/klO23nT2ehFDXCfx3eHTDRESMz3asj1muO+4aIdjiuY=",
// "sha256/grX4Ta9HpZx6tSHkmCrvpApTQGo67CYDnvprLg5yRME="
// };
//dbkeys
byte[][] keys = {
{-45, 38, 70, -101, -53, 80, 47, -11, -103, 19, 60, 72, 95, -86, 105, 121, -68, 58, 106, -100, -72, 56, -44, -43, 35, 100, -35, 40, 125, -93, 58, -120, 96, -56, 50, -18, -113, -50, 62, 27, -76, -36, -99, 36, 112, 62, -6, -39, 117, -56, -74, 68, 82, 35, -50, -109, -66, 11, 69, 124, 11, -36, -9, -1},
{-11,-95,82,80,114,-61,-119,-35,-87,38,34,79,-110,5,57,-93,-40,-83,46,53,-56,-86,-14,-114,52,95,67,5,-30,-91,-40,43,-88,-5,-74,11,38,-84,-33,89,-60,64,35,1,23,66,102,54,16,-116,59,51,127,55,20,-103,109,-52,-51,106,77,83,114,-118},
{-7,-12,-21,-123,-88,-7,115,-14,-81,102,-59,101,-108,-55,18,-101,-54,73,57,-1,116,17,-26,-2,61,-75,18,-47,55,64,-13,25,112,113,32,80,-23,119,84,24,9,25,-82,-115,61,35,117,-20,-2,-83,108,25,31,45,22,-29,-122,-33,44,11,-121,85,52,-4}
};
for (int i = 0; i < keys.length; i++) {
// String sourceStr = keys[i];
byte[] selT = keys[i];//sourceStr.getBytes(characterSet);
// String output = new String(selT, 0, selT.length, characterSet);
//
// log.append(sourceStr);
// if (sourceStr.equals(output)) {
// log.append(" EQ\t");
// } else {
// log.append(" NG\t");
// }
// log.append('\t');
byte[] out = soe.obfuscate(selT);
log.append(" {");
for (int j = 0; j < out.length; j++) {
log.append(String.valueOf(out[j]) + ",");
}
log.append(" }");
log.append('\t');
byte[] reout = soe.unobfuscate(out);
String outputRe = new String(reout, 0, reout.length, characterSet);
// if (!sourceStr.equals(outputRe)) {
// log.append(" NG\t");
// }
log.append('\n');
}
System.out.println(log.toString());
}
}