1
0
Fork 0

iteration 2 -> 4096

This commit is contained in:
Sangbum Kim 2016-10-10 15:38:47 +09:00
parent a623db316c
commit dba7f5f3b9
5 changed files with 20 additions and 12 deletions

View File

@ -13,8 +13,8 @@ buildscript {
} }
} }
mainClassName = 'Main' //mainClassName = 'Main'
//mainClassName = 'SimpleObfuscator' mainClassName = 'SimpleObfuscator'
//mainClassName = 'Crypt' //mainClassName = 'Crypt'

1
settings.gradle Normal file
View File

@ -0,0 +1 @@
rootProject.name = 'simple-encryptor'

View File

@ -38,7 +38,7 @@ public class SimpleEncryptor {
//PBKDF2WithHmacSHA256 //PBKDF2WithHmacSHA256
final PKCS5S2ParametersGenerator gen = new PKCS5S2ParametersGenerator(new SHA256Digest()); final PKCS5S2ParametersGenerator gen = new PKCS5S2ParametersGenerator(new SHA256Digest());
gen.init(keyValue, salt, 2); gen.init(keyValue, salt, 4096);
final byte[] dk = ((KeyParameter) gen.generateDerivedParameters(256)).getKey(); final byte[] dk = ((KeyParameter) gen.generateDerivedParameters(256)).getKey();
SecretKey secret = new SecretKeySpec(dk, "AES"); SecretKey secret = new SecretKeySpec(dk, "AES");

View File

@ -61,6 +61,9 @@ public class SimpleObfuscator {
// "sha256/SlNzY+e3VjHNRXeCxFsG74HzSkjeZ3jbqoSYCD+nBcE=", // "sha256/SlNzY+e3VjHNRXeCxFsG74HzSkjeZ3jbqoSYCD+nBcE=",
// "sha256/klO23nT2ehFDXCfx3eHTDRESMz3asj1muO+4aIdjiuY=", // "sha256/klO23nT2ehFDXCfx3eHTDRESMz3asj1muO+4aIdjiuY=",
// "sha256/grX4Ta9HpZx6tSHkmCrvpApTQGo67CYDnvprLg5yRME=" // "sha256/grX4Ta9HpZx6tSHkmCrvpApTQGo67CYDnvprLg5yRME="
// "WnEuMUmhEPwjPsFe864Ju7qTSQYHvvUs",
// "QF53h72JPMQ2vBuL",
// "9cPgDSmHe63z9zUu"
// }; // };
@ -70,9 +73,10 @@ public class SimpleObfuscator {
{-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}, {-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} {-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 < 1; i++) { for (int i = 0; i < keys.length; i++) {
// String sourceStr = keys[i]; // String sourceStr = keys[i];
//
// byte[] selT = sourceStr.getBytes(characterSet);
byte[] selT = keys[i]; byte[] selT = keys[i];
// String output = new String(selT, 0, selT.length, characterSet); // String output = new String(selT, 0, selT.length, characterSet);
@ -97,19 +101,22 @@ public class SimpleObfuscator {
// //
// log.append('\t'); // log.append('\t');
byte[] reout = soe.unobfuscate(selT); byte[] reout = soe.unobfuscate(out);
// String outputRe = new String(reout, 0, reout.length, characterSet); String outputRe = new String(reout, 0, reout.length, characterSet);
System.out.println(Arrays.toString(reout)); System.out.println(outputRe);
// if (!sourceStr.equals(outputRe)) { // if (!sourceStr.equals(outputRe)) {
// log.append(" NG\t"); // System.out.println("NG");
// }else{
// System.out.println("OK");
//
// } // }
// log.append('\n'); // log.append('\n');
} }
System.out.println(log.toString()); // System.out.println(log.toString());
} }
} }