-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
121 lines (108 loc) · 3.23 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="favicon.png" type="image/x-icon" />
<title>Parallel Desktop 19激活码获取</title>
<style>
body {
font-family: 'San Francisco', sans-serif;
background-color: #f5f5f7;
color: #363636;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
text-align: center;
background-color: white;
padding: 30px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
h1 {
margin-bottom: 20px;
}
input[type="text"] {
width: 100%;
max-width: 300px;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #d2d2d7;
border-radius: 4px;
}
button {
padding: 10px 20px;
background-color: #007aff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #005ea6;
}
#result {
font-size: 1.2em;
margin-top: 20px;
}
#message {
color: red;
margin-top: 10px;
display: none;
}
#logo {
max-width: 220px;
height: auto;
margin-bottom: 1px;
}
</style>
</head>
<body>
<div class="container">
<img src="pl-logo-dk.png" alt="Parallel Desktop Logo" id="logo">
<h1>Parallel Desktop 19激活码获取</h1>
<input type="text" id="uuidInput" placeholder="请输入电脑的UUID">
<button onclick="calculateActivationCode()">获取激活码</button>
<div id="result"></div>
<p id="message" style="color: red; display: none;"></p>
</div>
<script>
function calculateActivationCode() {
const uuidInput = document.getElementById('uuidInput').value.trim();
// UUID正则表达式
const uuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
if (!uuidInput) {
document.getElementById('message').innerText = '您还没有输入UUID';
document.getElementById('message').style.display = 'block';
return;
} else if (!uuidRegex.test(uuidInput)) {
document.getElementById('message').innerText = 'uuid格式错误';
document.getElementById('message').style.display = 'block';
return;
}
// 使用 SubtleCrypto API 生成哈希值
crypto.subtle.digest('SHA-256', new TextEncoder().encode(uuidInput))
.then(hashBuffer => {
// 将哈希值转换为十六进制字符串
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map(byte => byte.toString(16).padStart(2, '0')).join('');
// 取哈希值的前6位字符
const activationCode = hashHex.substring(0, 6);
// 显示结果
document.getElementById('result').innerText = `您的PD激活码:${activationCode}`;
document.getElementById('message').style.display = 'none';
})
.catch(error => {
console.error('Hash calculation failed:', error);
document.getElementById('message').innerText = '激活码获取失败';
document.getElementById('message').style.display = 'block';
});
}
</script>
</body>
</html>