所以我对此AHK脚本有一个疑问,它基本上是一个加密器和解密器。如果您运行该程序,则需要先输入密码,然后才能进入真实程序,因此,如果在其中输入一个字符串并“编码”,则可以通过任何方式将“编码”字符串保存到。 txt只需一个按钮?
我尝试使用Submit在Internet上找到一些东西,所以我并没有真正弄清楚。所以我有点卡在这里!
SetBatchLines -1
StringCaseSense Off
AutoTrim Off
Hotkey, !x, Exit
InputBox, pass ,Encrypter 1.0, Please enter the Password , HIDE, 190, 140
ifEqual pass, pass, GoSub, key
IfNotEqual, pass, pass, MsgBox , 0, Wrong Password, The password was incorrect please try again or press "ESC" to Exit the Programm
IfNotEqual, pass, pass, Reload
Sleep, 100
;----------------Interface--------------
Gui, 1: Add, Edit, x10 y10 w280 r8 vEncDec
Gui, 1: Font, bold
Gui, 1: Add, Text,, Copy and paste your raw text here to encrypt it.
Gui, 1: Color, d80101
Gui, 1: Add, Button, x10 y150 w75 gENCRYPT, Encode
Gui, 1: Add, Button, x10 y178 w75 gDELETE, Delete
Gui, 1: Add, Button, x110 y150 w75 gDECRYPT, Decode
Gui, 1: Add, Button, x110 y178 w75 gOPEN, Save
Gui, 1: Add, Button, x215 y150 w75 gExit, Exit
Gui, 1: Add, Button, x215 y178 w75 gCREATE, Create
Gui, 1: Show, w300 h208, Encrypter v1.0
Return
;------------------MANAGMENT---------------
DELETE:
MsgBox, 262208, WARNING!, If you delete the .txt all your Saved Passwords will be deleted!
Sleep 500
MsgBox, 262196, WARNING!, Do you really want to delete the .txt?
IfMsgBox Yes
FileDelete, %Temp%\ttcrashes.txt
return
CREATE:
MsgBox, 262208, WARNING!, If you create a new .txt your old .txt file may get deleted!
Sleep 500
MsgBox, 262196, WARNING!, Do you really want to create a new .txt?
IfMsgBox Yes
FileAppend,ENCODED:, %Temp%\ttcrashes.txt
return
OPEN:
Run, %Temp%\ttcrashes.txt
return
;-------------------Key--------------------
key:
k1 := 0x5025124 ;in each of these 5 keys edit the last 10 0s to random numbers so that they are each different and look something like this: 0x1928374659
k2 := 0x0681035170
k3 := 0x9704313523
k4 := 0x0427880892
k5 := 0x8754345242
return
;----------------Exit HK--------------------
Exit:
ExitApp
return
;-----------------------------------------------
;#############################################################################################################
ENCRYPT:
encrypt = 1
decrypt = 0
GoSub, EncryptDecrypt
Return
DECRYPT:
decrypt = 1
encrypt = 0
GoSub, EncryptDecrypt
Return
;#############################################################################################################
EncryptDecrypt:
Gui, 1: Submit, NoHide
i = 9
p = 0
L =
Loop % StrLen(EncDec)
{
i++
If i > 8
{
u := p
v := k5
p++
TEA(u,v, k1,k2,k3,k4)
Stream9(u,v)
i = 0
}
StringMid c, EncDec, A_Index, 1
a := Asc(c)
If a between 32 and 126
{
If encrypt = 1
{
a += s%i%
IfGreater a, 126, SetEnv, a, % a-95
c := Chr(a)
}
If decrypt = 1
{
a -= s%i%
IfLess a, 32, SetEnv, a, % a+95
c := Chr(a)
}
}
L = %L%%c%
}
GuiControl,, EncDec, %L%
Return
;#############################################################################################################
TEA(ByRef y,ByRef z,k0,k1,k2,k3) ; (y,z) = 64-bit I/0 block
{ ; (k0,k1,k2,k3) = 128-bit key
IntFormat = %A_FormatInteger%
SetFormat Integer, D ; needed for decimal indices
s := 0
d := 0x9E3779B9
Loop 32
{
k := "k" . s & 3 ; indexing the key
y := 0xFFFFFFFF & (y + ((z << 4 ^ z >> 5) + z ^ s + %k%))
s := 0xFFFFFFFF & (s + d) ; simulate 32 bit operations
k := "k" . s >> 11 & 3
z := 0xFFFFFFFF & (z + ((y << 4 ^ y >> 5) + y ^ s + %k%))
}
SetFormat Integer, %IntFormat%
y += 0
z += 0 ; Convert to original ineger format
}
Stream9(x,y) ; Convert 2 32-bit words to 9 pad values
{ ; 0 <= s0, s1, ... s8 <= 94
Local z ; makes all s%i% global
s0 := Floor(x*0.000000022118911147) ; 95/2**32
Loop 8
{
z := (y << 25) + (x >> 7) & 0xFFFFFFFF
y := (x << 25) + (y >> 7) & 0xFFFFFFFF
x = %z%
s%A_Index% := Floor(x*0.000000022118911147)
}
}
Esc::
ExitApp
return```
Well my expected result would be that if you press the "Save" Button on the GUI you the "Encoded" string gets saved into the .txt
答案 0 :(得分:0)
如Yane所述,正确的语法是FileAppend [,文本,文件名,编码]
使用以下方法之一可以按预期创建/修改文件。
FileAppend,ENCODED: %VariableName%, %Temp%\ttcrashes.txt
或
FileAppend,%VariableName%, %Temp%\ttcrashes.txt