How to use CryptAES in AHK_H V2?
I searched everywhere and did not find a solution.
How to use CryptAES in AHK_H V2?
Re: How to use CryptAES in AHK_H V2?
any help?
In Encoded I get this: 54 00 65 00 78 00 74 00.
In Decoded, I get an empty value.
When writing a long string to the "Text" variable, I get an empty value.
I'm probably doing something wrong.
Code: Select all
Text := "Text"
Bytes := StrLen(Text)
Encoded := ""
Decoded := ""
Base64.Encode(Text, Bytes)
Msgbox(Base64)
Msgbox Decoded := Base64.Decode(Encoded, Bytes)
ExitApp
Class Base64 {
Static Encode(Buf, Codec := 0x40000001) {
if Buf is String
p := StrPtr(Buf), s := StrLen(Buf) * 2
else p := Buf, s := Buf.Size
if (DllCall("crypt32\CryptBinaryToString", "Ptr", p, "UInt", s, "UInt", Codec, "Ptr", 0, "Uint*", &nSize := 0) &&
(VarSetStrCapacity(&VarOut, nSize << 1), DllCall("crypt32\CryptBinaryToString", "Ptr", p, "UInt", s, "UInt", Codec, "Str", VarOut, "Uint*", &nSize)))
return (VarSetStrCapacity(&VarOut, -1), VarOut)
}
Static Decode(VarIn, Codec := 0x00000001) {
if (DllCall("crypt32\CryptStringToBinary", "Str", VarIn, "UInt", 0, "UInt", Codec, "Ptr", 0, "Uint*", &SizeOut := 0, "Ptr", 0, "Ptr", 0) &&
DllCall("Crypt32.dll\CryptStringToBinary", "Str", VarIn, "UInt", 0, "UInt", Codec, "Ptr", VarOut := Buffer(SizeOut), "Uint*", &SizeOut, "Ptr", 0, "Ptr", 0))
return VarOut
}
}
In Decoded, I get an empty value.
When writing a long string to the "Text" variable, I get an empty value.
I'm probably doing something wrong.
Re: How to use CryptAES in AHK_H V2?
Isn't this Base64? the rettype of base64.decode is buffer.
CryptAES is the same.
https://github.com/thqby/vscode-autohotkey2-lsp/blob/main/syntaxes/ahk2_h.d.ahk#L21
CryptAES is the same.
https://github.com/thqby/vscode-autohotkey2-lsp/blob/main/syntaxes/ahk2_h.d.ahk#L21
Re: How to use CryptAES in AHK_H V2?
I found this already: viewtopic.php?t=81968
Thank you!
Thank you!
Who is online
Users browsing this forum: No registered users and 3 guests