|
|
|
|
@ -2,27 +2,30 @@ package encryptor;
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
|
|
|
|
|
public class Encryptor {
|
|
|
|
|
public native static String encryptStr(String str);
|
|
|
|
|
static
|
|
|
|
|
{
|
|
|
|
|
try{
|
|
|
|
|
String path = System.getProperty("user.dir")+"\\libs\\encrypt";
|
|
|
|
|
|
|
|
|
|
System.setProperty("java.library.path", path);
|
|
|
|
|
Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
|
|
|
|
|
fieldSysPath.setAccessible(true);
|
|
|
|
|
fieldSysPath.set(null, null);
|
|
|
|
|
|
|
|
|
|
System.loadLibrary("Encryptor");
|
|
|
|
|
}catch(Exception e)
|
|
|
|
|
{
|
|
|
|
|
System.out.println(e);
|
|
|
|
|
public static String encryptStr(String str){
|
|
|
|
|
long ulMacTmp = 0;
|
|
|
|
|
for (int i = 0; i < str.length(); i++) {
|
|
|
|
|
ulMacTmp = ulMacTmp << 4;
|
|
|
|
|
char cStr = str.charAt(i);
|
|
|
|
|
if (cStr >= '0' && cStr <= '9') {
|
|
|
|
|
ulMacTmp += (long)(str.charAt(i) - '0');
|
|
|
|
|
} else if (cStr >= 'a' && cStr <= 'f') {
|
|
|
|
|
ulMacTmp += (long)(str.charAt(i) - 'a' + 10);
|
|
|
|
|
} else if (cStr >= 'A' && cStr <= 'F') {
|
|
|
|
|
ulMacTmp += (long)(str.charAt(i) - 'A' + 10);
|
|
|
|
|
} else {
|
|
|
|
|
ulMacTmp += 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
str = String.valueOf(ulMacTmp);
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
String noEncrypt = "BFEBFBFF000A06530026_B768_466D_0235.";
|
|
|
|
|
String noEncrypt = "BFEBFBFF000A06550026_B728_2C38_69F5.";
|
|
|
|
|
String encrypt = Encryptor.encryptStr(noEncrypt);
|
|
|
|
|
System.out.println(encrypt);
|
|
|
|
|
}
|
|
|
|
|
|