-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
1 addition
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,3 @@ | ||
# FinalShell_Active | ||
|
||
``` | ||
import java.io.IOException; | ||
import java.security.MessageDigest; | ||
import java.security.NoSuchAlgorithmException; | ||
import java.util.Scanner; | ||
public class FinalShell { | ||
public static void main(String[] args) throws NoSuchAlgorithmException, IOException { | ||
Scanner reader = new Scanner(System.in); | ||
String machineCode = reader.nextLine(); | ||
generateKey(machineCode); | ||
} | ||
public static void generateKey(String hardwareId) throws NoSuchAlgorithmException { | ||
String proKey = transform(61305 + hardwareId + 8552); | ||
String pfKey = transform(2356 + hardwareId + 13593); | ||
System.out.println("高级版:" + proKey); | ||
System.out.println("专业版:" + pfKey); | ||
} | ||
public static String transform(String str) throws NoSuchAlgorithmException { | ||
String md5 = hashMD5(str); | ||
return hashMD5(str).substring(8, 24); | ||
} | ||
public static String hashMD5(String str) throws NoSuchAlgorithmException { | ||
MessageDigest digest = MessageDigest.getInstance("MD5"); | ||
byte[] hashed = digest.digest(str.getBytes()); | ||
StringBuilder sb = new StringBuilder(); | ||
for (byte b : hashed) { | ||
int len = b & 0xFF; | ||
if (len < 16) { | ||
sb.append("0"); | ||
} | ||
sb.append(Integer.toHexString(len)); | ||
} | ||
return sb.toString(); | ||
} | ||
} | ||
``` | ||
## 仅为个人学习测验使用,请在下载/激活后24小时内删除,不得用于商业用途,否则后果自负 |