硕士生
 
- 金币
- 2653
- 好评
- 7
- 信誉
- 100
|
用的AS 2023版本,以下是我提取的dex文件写的注册机算法,麻烦会的大佬帮我确认一下算法是否和dex的一致,然后帮我编译一个注册程序成品,最好能有源码打包的目录,让我学习一下,感激不尽。
DEX下载链接:https://www.123pan.com/s/9PY0Vv-o9lh.html
package cn.huatuban;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Toast;
public class KeyGeneratorActivity extends Activity {
private EditText etMachineCode, etActivationCode;
private Button btnGenerate, btnCopy;
private RadioGroup rgVersion;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_key_generator);
initViews();
setupListeners();
// 自动生成机器码
generateMachineCode();
}
private void initViews() {
etMachineCode = findViewById(R.id.et_machine_code);
etActivationCode = findViewById(R.id.et_activation_code);
btnGenerate = findViewById(R.id.btn_generate);
btnCopy = findViewById(R.id.btn_copy);
rgVersion = findViewById(R.id.rg_version);
}
private void setupListeners() {
btnGenerate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
generateActivationCode();
}
});
btnCopy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
copyToClipboard();
}
});
}
/**
* 生成机器码 - 模拟原程序的算法
*/
private void generateMachineCode() {
double random = Math.random() * 1.0E16d;
double random2 = Math.random() * 1.0E14d;
double random3 = Math.random() * 1.0E12d;
double random4 = Math.random() * 1.0E10d;
double random5 = Math.random() * 1.0E8d;
double b = (random + random2 + random3 + random4 + random5 +
(Math.random() * 1000000.0d) +
(Math.random() * 10000.0d) +
(Math.random() * 100.0d) +
1.981021256234567E15d) * 3.0d;
SharedPreferences sharedPreferences = getSharedPreferences("mm", 0);
long j;
try {
j = sharedPreferences.getLong("jiqi", 0L);
} catch (Exception unused) {
j = (long) (b * 1.0d);
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.putLong("jiqi", j);
edit.commit();
}
if (j < 32) {
j = (long) (b * 1.0d);
SharedPreferences.Editor edit2 = sharedPreferences.edit();
edit2.putLong("jiqi", j);
edit2.commit();
}
String str = "" + j;
long parseDouble = (long) Double.parseDouble(str.substring(0, 3) + 0 + str.substring(4));
etMachineCode.setText(String.valueOf(parseDouble));
}
/**
* 生成激活码
*/
private void generateActivationCode() {
String machineCodeStr = etMachineCode.getText().toString();
if (machineCodeStr.isEmpty()) {
showToast("请先生成机器码");
return;
}
try {
long machineCode = Long.parseLong(machineCodeStr);
String activationCode = calculateActivationCode(machineCode);
etActivationCode.setText(activationCode);
// 根据选择的版本保存相应的注册信息
saveRegistrationInfo(activationCode);
showToast("激活码生成成功!");
} catch (NumberFormatException e) {
showToast("机器码格式错误");
}
}
/**
* 计算激活码核心算法
*/
private String calculateActivationCode(long machineCode) {
double result = (((((((double) machineCode) + 3.1415926535898d) * 3.0d) -
1.981021256234567E15d) * 2.0d) -
1.981021256234567E15d) * 5.0d;
return String.valueOf((long) result);
}
/**
* 保存注册信息
*/
private void saveRegistrationInfo(String activationCode) {
SharedPreferences.Editor edit = getSharedPreferences("mm", 0).edit();
int selectedId = rgVersion.getCheckedRadioButtonId();
if (selectedId == R.id.rb_enhanced) {
// 增强版 - 使用固定的注册字符串
edit.putString("zhuche", "5261af@h&063#01p*o$8f!jf5]473%10~1");
edit.putInt("sb", 0); // 增强版标识
showToast("增强版激活码已生成");
} else {
// 普通版
edit.putString("zhuche", activationCode);
edit.putInt("sb", 1); // 普通版标识
showToast("普通版激活码已生成");
}
edit.commit();
}
/**
* 复制到剪贴板
*/
private void copyToClipboard() {
String activationCode = etActivationCode.getText().toString();
if (!activationCode.isEmpty()) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("激活码", activationCode);
clipboard.setPrimaryClip(clip);
showToast("激活码已复制到剪贴板");
} else {
showToast("没有可复制的激活码");
}
}
private void showToast(String message) {
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
}
} |
|