通用加密登录模块

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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
请帮我把下面【通用加密登录模块】无缝移植到我新提供的【目标源码】中。

【移植要求】:
1. 采用“双进程隔离架构”:在代码头部建立进程路由(利用 A_Args[1] 判断参数)。
2. 默认启动(Role = "" 且无参数)时,进入 `AuthProcess` 标签,运行登录验证界面和心跳守护逻辑。
3. 登录并网络验证成功后,由验证进程以 `/Main` 为参数拉起原始主程序,并隐藏在后台循环执行 `HeartbeatCheck` 和 `ProcessCheck`。
4. 原【目标源码】的所有初始化和核心业务逻辑,统一放入 `MainProcess:` 标签下执行。如果目标源码本身也是多进程架构(如 /Trade, /Net),请把原始默认启动逻辑归入 `/Main`,并正确传递路径等环境变量。
5. 验证失效或心跳断开时,通过强杀主程序 PID 的方式优雅终止原始源码。
6. 将【通用加密登录模块】中的所有 GUI 标签、`HeartbeatCheck` 以及底部所有的 `__Sec_` 辅助函数,完整保留并添加到新代码中。
7. 绝对禁止修改、增加或删除原【目标源码】本身的任何业务逻辑和功能。

==================================================
【通用加密登录模块 AHK 代码模板】:
==================================================

; ==============================================================================
; 0_验证守护进程_AuthProcess (独立进程)
; ==============================================================================
AuthProcess:
Global FullUrl := "http://www.example.com" ; 需替换为实际验证网址
Global AppKey := "default_app" ; 需替换为实际 AppKey
Global AppVersion := "1.0" ; 需替换为实际版本号
Global AppSecret := "secret_123" ; 需替换为实际通信秘钥

Global LoginToken := ""
Global LastGuiX := ""
Global LastGuiY := ""
Global hLoginGui := ""
Global hRegGui := ""
Global hFwdGui := ""

Global ServerNotice := ""
Global ServerDownloadUrl := ""

Global HbEnabled := 1
Global HbInterval := 300
Global NetworkFailCount := 0

Global AuthFilterConfigFile := A_ScriptDir . "\LoginSettings.ini"
IniRead, SavedNetworkAccount, %AuthFilterConfigFile%, NetworkSettings, NetworkAccount, %A_Space%
IniRead, SavedNetworkPassword, %AuthFilterConfigFile%, NetworkSettings, NetworkPassword, %A_Space%
Global SavedNetworkAccount := Trim(SavedNetworkAccount)
Global SavedNetworkPassword := Trim(SavedNetworkPassword)
Global MachineCode := __Sec_GetMachineCode()

; 启动时获取公告和更新链接
try {
whrInfo := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whrInfo.Open("POST", FullUrl . "/api/info", true)
whrInfo.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
whrInfo.Send("app_key=" . AppKey)
whrInfo.WaitForResponse()
resInfo := whrInfo.responseText

RegExMatch(resInfo, """download_url"":\s*""([^""]*)""", dMatch)
RegExMatch(resInfo, """notice"":\s*""([^""]*)""", nMatch)

ServerDownloadUrl := __Sec_UnescapeUnicode(dMatch1)
ServerDownloadUrl := StrReplace(ServerDownloadUrl, "\/", "/")
ServerNotice := __Sec_UnescapeUnicode(nMatch1)
ServerNotice := StrReplace(ServerNotice, "\n", "`n")
ServerNotice := StrReplace(ServerNotice, "<br>", "`n")
ServerNotice := RegExReplace(ServerNotice, "<[^>]+>", "")
} catch {
ServerNotice := "无法连接到服务器,可能处于离线模式或网络异常。"
}

GoSub, ShowLogin
Return

ShowLogin:
__Sec_SaveWinPos()
Gui, RegGUI:Destroy
Gui, FwdGUI:Destroy

Gui, LoginGUI:New, +AlwaysOnTop -MaximizeBox -MinimizeBox +OwnDialogs +HwndhLoginGui, 系统登录验证
Gui, LoginGUI:Color, FFFFFF

Gui, LoginGUI:Font, s18 bold c1e293b, Microsoft YaHei
Gui, LoginGUI:Add, Text, x0 y50 w350 Center, 系统登录
Gui, LoginGUI:Font, s10 norm c64748b
Gui, LoginGUI:Add, Text, x0 y90 w350 Center, 登录后即可进行验证授权

Gui, LoginGUI:Font, s10 c334155
Gui, LoginGUI:Add, Text, x35 y135 w280, 登录账号:
Gui, LoginGUI:Add, Edit, x35 y160 w280 h28 vAccount, %SavedNetworkAccount%
Gui, LoginGUI:Add, Text, x35 y205 w280, 登录密码:
Gui, LoginGUI:Add, Edit, x35 y230 w280 h28 Password vPassword, %SavedNetworkPassword%

Gui, LoginGUI:Font, s9 norm cEF4444
Gui, LoginGUI:Add, Text, x35 y275 w280 h20 Center vLoginError,

Gui, LoginGUI:Font, s11 bold cFFFFFF
Gui, LoginGUI:Add, Button, x35 y300 w280 h40 gDoLogin Default vBtnLogin, 立即登录

Gui, LoginGUI:Font, s9 norm c2563eb
Gui, LoginGUI:Add, Text, x55 y360 gShowRegister BackgroundTrans, 没有账号?立即注册
Gui, LoginGUI:Add, Text, x240 y360 gShowFindPwd BackgroundTrans, 找回密码

Gui, LoginGUI:Add, Text, x350 y40 w2 h360 0x11

Gui, LoginGUI:Font, s14 bold c1e293b
Gui, LoginGUI:Add, Text, x370 y30 w250 Center, 公告
Gui, LoginGUI:Font, s10 norm c475569
Gui, LoginGUI:Add, Edit, x370 y70 w250 h300 ReadOnly Multi VScroll -E0x200, %ServerNotice%

if (ServerDownloadUrl != "") {
Gui, LoginGUI:Font, s10 bold c10b981
Gui, LoginGUI:Add, Button, x370 y380 w250 h35 gOpenDownloadLink, 下载更新版本
}

posStr := (LastGuiX != "" && LastGuiY != "") ? " x" LastGuiX " y" LastGuiY : ""
Gui, LoginGUI:Show, w640 h440 %posStr%
Return

DoLogin:
Gui, LoginGUI:Submit, NoHide
GuiControl, LoginGUI:, LoginError,
if (Account = "" || Password = "") {
GuiControl, LoginGUI:, LoginError, 请输入完整账号和密码!
return
}
GuiControl, LoginGUI:Disable, BtnLogin
GuiControl, LoginGUI:, BtnLogin, 正在验证...
try {
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("POST", FullUrl . "/api/login", true)
whr.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
whr.Send("account=" . __Sec_UriEncode(Account) . "&password=" . __Sec_UriEncode(Password) . "&machine_code=" . MachineCode . "&app_key=" . AppKey)
whr.WaitForResponse()
res := whr.responseText

RegExMatch(res, """status"":\s*""([^""]+)""", statusMatch)
RegExMatch(res, """msg"":\s*""([^""]+)""", msgMatch)
RegExMatch(res, """token"":\s*""([^""]+)""", tokenMatch)

RegExMatch(res, """heartbeat_enabled"":\s*(\d+)", hbEnMatch)
RegExMatch(res, """heartbeat_interval"":\s*(\d+)", hbIntMatch)

msgText := __Sec_UnescapeUnicode(msgMatch1)
msgText := StrReplace(msgText, "\n", " ")

if (statusMatch1 = "success") {
IniWrite, %Account%, %AuthFilterConfigFile%, NetworkSettings, NetworkAccount
IniWrite, %Password%, %AuthFilterConfigFile%, NetworkSettings, NetworkPassword
LoginToken := tokenMatch1

HbEnabled := (hbEnMatch1 != "") ? hbEnMatch1 : 1
HbInterval := (hbIntMatch1 != "") ? hbIntMatch1 : 300
NetworkFailCount := 0

Gui, LoginGUI:Destroy
GoSub, RunMainApp
} else {
GuiControl, LoginGUI:, LoginError, %msgText%
GuiControl, LoginGUI:Enable, BtnLogin
GuiControl, LoginGUI:, BtnLogin, 立即登录
}
} catch e {
GuiControl, LoginGUI:, LoginError, 无法连接到服务器,请检查网络!
GuiControl, LoginGUI:Enable, BtnLogin
GuiControl, LoginGUI:, BtnLogin, 立即登录
}
Return

ShowRegister:
__Sec_SaveWinPos()
Gui, LoginGUI:Destroy
Gui, FwdGUI:Destroy

Gui, RegGUI:New, +AlwaysOnTop -MaximizeBox -MinimizeBox +OwnDialogs +HwndhRegGui, 用户注册
Gui, RegGUI:Color, FFFFFF

Gui, RegGUI:Font, s18 bold c1e293b, Microsoft YaHei
Gui, RegGUI:Add, Text, x0 y35 w350 Center, 用户注册
Gui, RegGUI:Font, s10 norm c64748b
Gui, RegGUI:Add, Text, x0 y65 w350 Center, 填写信息完成注册即可使用

Gui, RegGUI:Font, s10 c334155
Gui, RegGUI:Add, Text, x35 y105 w280, 用户名:
Gui, RegGUI:Add, Edit, x35 y125 w280 h26 vRegUsername
Gui, RegGUI:Add, Text, x35 y160 w280, 登录账号:
Gui, RegGUI:Add, Edit, x35 y180 w280 h26 vRegAccount
Gui, RegGUI:Add, Text, x35 y215 w280, 登录密码:
Gui, RegGUI:Add, Edit, x35 y235 w280 h26 Password vRegPassword
Gui, RegGUI:Add, Text, x35 y270 w280, QQ号 (用于找回密码):
Gui, RegGUI:Add, Edit, x35 y290 w280 h26 vRegQQ

Gui, RegGUI:Font, s9 norm cEF4444
Gui, RegGUI:Add, Text, x35 y325 w280 h20 Center vRegError,

Gui, RegGUI:Font, s11 bold cFFFFFF
Gui, RegGUI:Add, Button, x35 y350 w280 h40 gDoRegister Default vBtnReg, 完成注册

Gui, RegGUI:Font, s9 norm c2563eb
Gui, RegGUI:Add, Text, x125 y405 gShowLogin BackgroundTrans, 已有账号?返回登录

Gui, RegGUI:Add, Text, x350 y40 w2 h360 0x11
Gui, RegGUI:Font, s14 bold c1e293b
Gui, RegGUI:Add, Text, x370 y30 w250 Center, 公告
Gui, RegGUI:Font, s10 norm c475569
Gui, RegGUI:Add, Edit, x370 y70 w250 h300 ReadOnly Multi VScroll -E0x200, %ServerNotice%
if (ServerDownloadUrl != "") {
Gui, RegGUI:Font, s10 bold c10b981
Gui, RegGUI:Add, Button, x370 y380 w250 h35 gOpenDownloadLink, 下载更新版本
}

posStr := (LastGuiX != "" && LastGuiY != "") ? " x" LastGuiX " y" LastGuiY : ""
Gui, RegGUI:Show, w640 h440 %posStr%
Return

DoRegister:
Gui, RegGUI:Submit, NoHide
GuiControl, RegGUI:, RegError,
if (RegUsername = "" || RegAccount = "" || RegPassword = "" || RegQQ = "") {
GuiControl, RegGUI:, RegError, 请填写完整注册信息!
return
}
GuiControl, RegGUI:Disable, BtnReg
GuiControl, RegGUI:, BtnReg, 提交注册中...
try {
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("POST", FullUrl . "/api/register", true)
whr.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
whr.Send("username=" . __Sec_UriEncode(RegUsername) . "&account=" . __Sec_UriEncode(RegAccount) . "&password=" . __Sec_UriEncode(RegPassword) . "&qq_number=" . __Sec_UriEncode(RegQQ) . "&app_key=" . AppKey)
whr.WaitForResponse()
res := whr.responseText

RegExMatch(res, """status"":\s*""([^""]+)""", statusMatch)
RegExMatch(res, """msg"":\s*""([^""]+)""", msgMatch)
msgText := __Sec_UnescapeUnicode(msgMatch1)
msgText := StrReplace(msgText, "\n", " ")

if (statusMatch1 = "success") {
MsgBox, 262208, 注册成功, %msgText%
GoSub, ShowLogin
} else {
GuiControl, RegGUI:, RegError, %msgText%
GuiControl, RegGUI:Enable, BtnReg
GuiControl, RegGUI:, BtnReg, 完成注册
}
} catch e {
GuiControl, RegGUI:, RegError, 无法连接到服务器!
GuiControl, RegGUI:Enable, BtnReg
GuiControl, RegGUI:, BtnReg, 完成注册
}
Return

ShowFindPwd:
__Sec_SaveWinPos()
Gui, LoginGUI:Destroy
Gui, RegGUI:Destroy

Gui, FwdGUI:New, +AlwaysOnTop -MaximizeBox -MinimizeBox +OwnDialogs +HwndhFwdGui, 找回密码
Gui, FwdGUI:Color, FFFFFF

Gui, FwdGUI:Font, s18 bold c1e293b, Microsoft YaHei
Gui, FwdGUI:Add, Text, x0 y50 w350 Center, 找回密码
Gui, FwdGUI:Font, s10 norm c64748b
Gui, FwdGUI:Add, Text, x0 y90 w350 Center, 输入QQ号找回账号并重置密码

Gui, FwdGUI:Font, s10 c334155
Gui, FwdGUI:Add, Text, x35 y140 w280, 注册时填写的QQ号:
Gui, FwdGUI:Add, Edit, x35 y165 w280 h28 vFwdQQ
Gui, FwdGUI:Add, Text, x35 y215 w280, 新密码 (留空仅查询账号):
Gui, FwdGUI:Add, Edit, x35 y240 w280 h28 Password vFwdPassword

Gui, FwdGUI:Font, s9 norm cEF4444
Gui, FwdGUI:Add, Text, x35 y285 w280 h20 Center vFwdError,

Gui, FwdGUI:Font, s11 bold cFFFFFF
Gui, FwdGUI:Add, Button, x35 y310 w280 h40 gDoFindPwd Default vBtnFwd, 找回 / 重置

Gui, FwdGUI:Font, s9 norm c2563eb
Gui, FwdGUI:Add, Text, x145 y370 gShowLogin BackgroundTrans, 返回登录

Gui, FwdGUI:Add, Text, x350 y40 w2 h360 0x11
Gui, FwdGUI:Font, s14 bold c1e293b
Gui, FwdGUI:Add, Text, x370 y30 w250 Center, 公告
Gui, FwdGUI:Font, s10 norm c475569
Gui, FwdGUI:Add, Edit, x370 y70 w250 h300 ReadOnly Multi VScroll -E0x200, %ServerNotice%
if (ServerDownloadUrl != "") {
Gui, FwdGUI:Font, s10 bold c10b981
Gui, FwdGUI:Add, Button, x370 y380 w250 h35 gOpenDownloadLink, 下载更新版本
}

posStr := (LastGuiX != "" && LastGuiY != "") ? " x" LastGuiX " y" LastGuiY : ""
Gui, FwdGUI:Show, w640 h440 %posStr%
Return

DoFindPwd:
Gui, FwdGUI:Submit, NoHide
GuiControl, FwdGUI:, FwdError,
if (FwdQQ = "") {
GuiControl, FwdGUI:, FwdError, 请输入QQ号!
return
}
GuiControl, FwdGUI:Disable, BtnFwd
GuiControl, FwdGUI:, BtnFwd, 处理中...
try {
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("POST", FullUrl . "/api/find_pwd", true)
whr.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
whr.Send("qq_number=" . __Sec_UriEncode(FwdQQ) . "&new_password=" . __Sec_UriEncode(FwdPassword))
whr.WaitForResponse()
res := whr.responseText

RegExMatch(res, """status"":\s*""([^""]+)""", statusMatch)
RegExMatch(res, """msg"":\s*""([^""]+)""", msgMatch)
msgText := __Sec_UnescapeUnicode(msgMatch1)
msgText := StrReplace(msgText, "\n", "`n")

if (statusMatch1 = "success") {
MsgBox, 262208, 找回成功, %msgText%
GoSub, ShowLogin
} else {
GuiControl, FwdGUI:, FwdError, %msgText%
GuiControl, FwdGUI:Enable, BtnFwd
GuiControl, FwdGUI:, BtnFwd, 找回 / 重置
}
} catch e {
GuiControl, FwdGUI:, FwdError, 无法连接到服务器!
GuiControl, FwdGUI:Enable, BtnFwd
GuiControl, FwdGUI:, BtnFwd, 找回 / 重置
}
Return

OpenDownloadLink:
Run, %ServerDownloadUrl%
Return

LoginGUIGuiClose:
RegGUIGuiClose:
FwdGUIGuiClose:
ExitApp

RunMainApp:
if A_IsCompiled {
Run, "%A_ScriptFullPath%" /Main, %A_ScriptDir%, UseErrorLevel, MainPID
} else {
Run, "%A_AhkPath%" "%A_ScriptFullPath%" /Main, %A_ScriptDir%, UseErrorLevel, MainPID
}
global MainPID := MainPID

SetTimer, ProcessCheck, 2000
If (HbEnabled = 1) {
IntervalMs := HbInterval * 1000
SetTimer, HeartbeatCheck, %IntervalMs%
} Else {
SetTimer, HeartbeatCheck, Off
}
Return

ProcessCheck:
Process, Exist, %MainPID%
if (!ErrorLevel) {
ExitApp
}
Return

HeartbeatCheck:
try {
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("POST", FullUrl . "/api/check", true)
whr.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
whr.SetRequestHeader("Cookie", "proxy_login=" . LoginToken)
whr.Send("machine_code=" . MachineCode)
whr.WaitForResponse()
res := whr.responseText

NetworkFailCount := 0

RegExMatch(res, """status"":\s*""([^""]+)""", statusMatch)
RegExMatch(res, """msg"":\s*""([^""]+)""", msgMatch)
RegExMatch(res, """time"":\s*(\d+)", timeMatch)
RegExMatch(res, """sign"":\s*""([^""]+)""", signMatch)

RegExMatch(res, """heartbeat_enabled"":\s*(\d+)", hbEnMatch)
RegExMatch(res, """heartbeat_interval"":\s*(\d+)", hbIntMatch)

msgText := __Sec_UnescapeUnicode(msgMatch1)

if (statusMatch1 != "success") {
SetTimer, HeartbeatCheck, Off
SetTimer, ProcessCheck, Off
DetectHiddenWindows, On
WinClose, ahk_class AutoHotkey ahk_pid %MainPID%
DetectHiddenWindows, Off
MsgBox, 262192, 验证失效, 授权已失效!主程序已强制结束。`n原因: %msgText%
GoSub, ShowLogin
return
}

strToSign := "success" . msgText . timeMatch1 . AppSecret
if (__Sec_MD5(strToSign) != signMatch1) {
SetTimer, HeartbeatCheck, Off
SetTimer, ProcessCheck, Off
DetectHiddenWindows, On
WinClose, ahk_class AutoHotkey ahk_pid %MainPID%
DetectHiddenWindows, Off
MsgBox, 262192, 安全警告, 数据签名校验失败,可能遭到非法篡改!主程序已强制结束。
GoSub, ShowLogin
return
}

newHbEnabled := (hbEnMatch1 != "") ? hbEnMatch1 : 1
newHbInterval := (hbIntMatch1 != "") ? hbIntMatch1 : 300

if (newHbEnabled != HbEnabled || newHbInterval != HbInterval) {
HbEnabled := newHbEnabled
HbInterval := newHbInterval
If (HbEnabled = 1) {
IntervalMs := HbInterval * 1000
SetTimer, HeartbeatCheck, %IntervalMs%
} Else {
SetTimer, HeartbeatCheck, Off
}
}
} catch {
}
Return

; ==============================================================================
; 验证加密模块 - 辅助全局函数区 (需追加至代码最末尾)
; ==============================================================================

__Sec_SaveWinPos() {
global
If WinExist("ahk_id " hLoginGui)
WinGetPos, LastGuiX, LastGuiY,,, ahk_id %hLoginGui%
Else If WinExist("ahk_id " hRegGui)
WinGetPos, LastGuiX, LastGuiY,,, ahk_id %hRegGui%
Else If WinExist("ahk_id " hFwdGui)
WinGetPos, LastGuiX, LastGuiY,,, ahk_id %hFwdGui%
}

__Sec_GetMachineCode() {
DriveGet, serial, Serial, C:
return "PC-" . Abs(serial)
}

__Sec_UriEncode(str) {
Res := ""
VarSetCapacity(Var, StrPut(str, "UTF-8"), 0)
StrPut(str, &Var, "UTF-8")
While Code := NumGet(Var, A_Index - 1, "UChar") {
If (Code >= 48 && Code <= 57 || Code >= 65 && Code <= 90 || Code >= 97 && Code <= 122)
Res .= Chr(Code)
Else
Res .= Format("%{:02X}", Code)
}
Return Res
}

__Sec_UnescapeUnicode(str) {
pos := 1
while RegExMatch(str, "\\u([0-9a-fA-F]{4})", match, pos) {
str := StrReplace(str, match, Chr("0x" match1))
pos := InStr(str, match) + 1
}
return str
}

__Sec_MD5(string) {
VarSetCapacity(Buffer, StrPut(string, "UTF-8") - 1)
len := StrPut(string, &Buffer, "UTF-8") - 1
hProv := hHash := 0
if DllCall("advapi32\CryptAcquireContext", "Ptr*", hProv, "Ptr", 0, "Ptr", 0, "UInt", 1, "UInt", 0xF0000000) {
if DllCall("advapi32\CryptCreateHash", "Ptr", hProv, "UInt", 0x8003, "UInt", 0, "UInt", 0, "Ptr*", hHash) {
DllCall("advapi32\CryptHashData", "Ptr", hHash, "Ptr", &Buffer, "UInt", len, "UInt", 0)
DllCall("advapi32\CryptGetHashParam", "Ptr", hHash, "UInt", 2, "Ptr", 0, "UInt*", hashLen, "UInt", 0)
VarSetCapacity(hashVal, hashLen, 0)
DllCall("advapi32\CryptGetHashParam", "Ptr", hHash, "UInt", 2, "Ptr", &hashVal, "UInt*", hashLen, "UInt", 0)
DllCall("advapi32\CryptDestroyHash", "Ptr", hHash)
}
DllCall("advapi32\CryptReleaseContext", "Ptr", hProv, "UInt", 0)
}
o := ""
loop % hashLen
o .= Format("{:02x}", NumGet(hashVal, A_Index - 1, "UChar"))
return o
}

==================================================
【待接入验证的目标源码】:
==================================================
(请在此处粘贴您的新代码)