The problem has been solved, thank you very much to this friend.
Danyfirex https://www.autoitscript.com/forum/profile/71248-danyfirex/
At the same time, share the code, and if there are other friends who need it, they can refer to and learn from it.
Local $sSecret = "b8pW9XRUxIDdapjpLcjFte"
Local $iTimeStamp= 1705638000
ConsoleWrite("HMAC-SHA256: " & @TAB & @TAB & _HashHMAC($sSecret,$iTimeStamp) & @CRLF)
Func _HashHMAC($sSecret,$TimeStamp)
Local $oHashHMACErrorHandler = ObjEvent("AutoIt.Error", "_HashHMACErrorHandler")
Local $oHMAC = ObjCreate("System.Security.Cryptography.HMACSHA256")
If @error Then SetError(1, 0, "")
Local $sStrToSign =StringFormat("%s\n%s",$TimeStamp,$sSecret)
$oHMAC.key = Binary($sStrToSign)
Local $bHash = $oHMAC.ComputeHash_2(Binary(""))
Return _Base64Encode($bHash)
EndFunc ;==>_HashHMAC
Func _Base64Encode($input)
$input = Binary($input)
Local $struct = DllStructCreate("byte[" & BinaryLen($input) & "]")
DllStructSetData($struct, 1, $input)
Local $strc = DllStructCreate("int")
Local $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _
"ptr", DllStructGetPtr($struct), _
"int", DllStructGetSize($struct), _
"int", 1, _
"ptr", 0, _
"ptr", DllStructGetPtr($strc))
If @error Or Not $a_Call[0] Then
Return SetError(1, 0, "") ; error calculating the length of the buffer needed
EndIf
Local $a = DllStructCreate("char[" & DllStructGetData($strc, 1) & "]")
$a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _
"ptr", DllStructGetPtr($struct), _
"int", DllStructGetSize($struct), _
"int", 1, _
"ptr", DllStructGetPtr($a), _
"ptr", DllStructGetPtr($strc))
If @error Or Not $a_Call[0] Then
Return SetError(2, 0, ""); error encoding
EndIf
Return DllStructGetData($a, 1)
EndFunc ;==>_Base64Encode
Func _HashHMACErrorHandler($oError)
;Dummy Error Handler
EndFunc ;==>_HashHMACErrorHandler