-
Notifications
You must be signed in to change notification settings - Fork 0
/
XorShiftOffset.html
202 lines (180 loc) · 6.24 KB
/
XorShiftOffset.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>文件偏移值模糊计算器</title>
<meta name="author" content="letleon">
<meta name="author" content="claude-3-5-sonnet-20240620">
<style>
body {
max-width: 800px;
margin: 0 auto;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
padding: 20px;
background-color: #f5f5f7;
color: #1d1d1f;
}
.container {
background-color: white;
border-radius: 10px;
padding: 20px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
h1 {
font-weight: 100;
font-size: 60px;
padding-bottom: 40px;
margin: 0;
text-align: center;
}
h3 {
line-height: 0;
font-size: 25px;
font-weight: 300;
}
input,
select,
button {
font-size: 35px;
padding: 10px;
margin: 10px 0;
border: 1px solid #d2d2d7;
border-radius: 5px;
width: 100%;
box-sizing: border-box;
}
button {
background-color: #0071e3;
color: white;
border: none;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #0077ed;
}
#output {
white-space: pre-wrap;
font-family: monospace;
border: 1px solid #d2d2d7;
border-radius: 5px;
padding: 10px;
margin-top: 20px;
background-color: #f5f5f7;
max-height: 400px;
overflow-y: auto;
font-size: 25px;
}
footer {
padding: 20px;
color: var(--label-color);
font-size: 18px;
display: flex;
justify-content: center;
}
footer p {
margin: 0 10px;
}
</style>
</head>
<body>
<h1>文件偏移值模糊计算器</h1>
<div class="container">
<h3>类型</h3>
<select id="inputType" onchange="selectfnc(event)">
<option value="nameBlank">名称空白 (0x60-0x6F)</option>
<option value="identifier">数据标识 (0x74-0x77)</option>
<option value="dataOffset">数据偏移 (0x78-0x7B)</option>
</select>
<h3>偏移值</h3>
<input type="text" id="input" placeholder="A0 7A 00 00 或 A07A00000" value="00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00">
<h3>块大小</h3>
<select id="blockSize">
<option value="4096">0x1000 (4096 bytes)</option>
<option value="8192">0x2000 (8192 bytes)</option>
<option value="16384">0x4000 (16384 bytes)</option>
<option value="32768">0x8000 (32768 bytes)</option>
<option value="65536">0x10000 (65536 bytes)</option>
</select>
<button onclick="processInput()">计算</button>
<div id="output"></div>
</div>
<footer style="text-align: center; padding: 20px; color: var(--label-color); font-size: 14px;">
<p>Powered by: letleon</p>
<p>Ai assistant powered by: claude-3-5-sonnet-20240620</p>
</footer>
<script>
let PdeKey = new Uint8Array(0x10000);
function generateKey() {
let EAX = 0x42574954;
for (let i = 0; i < 0x10000; ++i) {
EAX = Math.imul(EAX, 0x7FCF) >>> 0;
const ECX = (EAX >>> 24) & 0xFF;
const EDX = (EAX >>> 16) & 0xFF;
let CL = ECX ^ EDX;
CL ^= (EAX >>> 8) & 0xFF;
CL ^= EAX & 0xFF;
PdeKey[i] = CL & 0xFF;
}
}
function selectfnc(e) {
const { value } = e.target
console.log(value);
switch (value) {
case 'nameBlank':
document.getElementById('input').value = '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00';
break;
case 'identifier':
document.getElementById('input').value = 'C7 D5 CC 01';
break;
case 'dataOffset':
document.getElementById('input').value = '5F 6A 02 00';
break;
default:
break;
}
}
function hexToBytes(hex) {
hex = hex.replace(/\s/g, '');
if (hex.length % 2 !== 0) {
hex = '0' + hex;
}
const bytes = [];
for (let i = 0; i < hex.length; i += 2) {
bytes.push(parseInt(hex.substr(i, 2), 16));
}
return bytes;
}
function bytesToHex(bytes) {
return bytes.map(b => b.toString(16).padStart(2, '0').toUpperCase()).join(' ');
}
function processInput() {
const input = document.getElementById('input').value;
if (!input)
return;
const inputBytes = hexToBytes(input);
const blockSize = parseInt(document.getElementById('blockSize').value);
const inputType = document.getElementById('inputType').value;
let output = '';
const fileCount = blockSize / 0x80;
for (let i = 0; i < fileCount; i++) {
let offset;
if (inputType === 'dataOffset') {
offset = i * 0x80 + 0x78;
} else if (inputType === 'identifier') {
offset = i * 0x80 + 0x74;
} else if (inputType === 'nameBlank') {
offset = i * 0x80 + 0x60;
}
const encryptedBytes = inputBytes.map((b, j) => b ^ PdeKey[offset + j]);
output += `${i + 1}: ${bytesToHex(encryptedBytes)}\n`;
}
document.getElementById('output').textContent = output;
}
window.onload = function () {
generateKey();
}
</script>
</body>
</html>