 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Rajat
Joined: 28 Mar 2004 Posts: 1687
|
Posted: Tue Aug 10, 2004 10:22 am Post subject: RC4 Encryption |
|
|
This script will perform actual RC4 encryption.
Give it 'pw' and 'data' and 'Gosub Rc4'.
'Result' contains en(de)crypted data.
I optimised it a lot compared to original and now its much faster.
Script _________________

Last edited by Rajat on Sun Jun 19, 2005 8:12 pm; edited 3 times in total |
|
| Back to top |
|
 |
MikeG
Joined: 23 Apr 2004 Posts: 34 Location: Adelaide, South Australia
|
Posted: Mon Aug 23, 2004 11:39 am Post subject: limitations? |
|
|
Hi Rajat,
I haven't fully examined the logic of this but it seems only to work for small amounts of data. The limit varies but is only a few hundred bytes, after which the data remains as cyphertext. Or perhaps are certain characters having unexpected effects? |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1687
|
Posted: Mon Aug 23, 2004 3:51 pm Post subject: |
|
|
i've checked it only for small text snippets. i use it at a couple of places but only for small text portions, for complete files or drives etc. i use specialesed tools. _________________
 |
|
| Back to top |
|
 |
d3m0n1x
Joined: 04 May 2005 Posts: 16
|
Posted: Thu Jun 09, 2005 8:11 pm Post subject: |
|
|
cool script. was wondering if u could help me. I needed a script that would encrypt a password & save it 2 a different file then decrypt it when i ran commands that used the password.
Example of command: | Code: |
$Numpad1::
Send,\
Sleep, 100
Send, rcon password sv_players
return |
|
|
| Back to top |
|
 |
d3m0n1x
Joined: 04 May 2005 Posts: 16
|
Posted: Thu Jun 09, 2005 11:53 pm Post subject: |
|
|
Well this is what I have done so far:
| Code: |
NoPassFound = RCON
EnterPass = Please enter Password.
iniread, RemRCONPass, RCONPASS.INI,Remember,RCONPass,0
iniread, RCONPass, RCONPASS.INI, DATA, RCONPass, 00
iniread, RemPassState, RCONPASS.INI, Remember, PassState, 1
iniread, PassState, RCONPASS.INI, DATA, PassState, 1
ifnotexist RCONPASS.INI
ifequal, RCONPass, 00
RCONPass =
start:
Gui, Add, Checkbox, x185 y82 w20 h20 vPassState Checked%PassState%
Gui, Add, Text, x45 y10 w145 h20, %EnterPass%
ifequal, PassState, 1
Gui, Add, Edit, x20 y35 w160 h20 vRCONPass Password, %RCONPass%
ifequal, PassState, 0
Gui, Add, Edit, x20 y40 w160 h20 vRCONPass, %RCONPass%
Gui, Add, Button, x35 y70 w50 h20, OK
Gui, Add, Button, x120 y70 w50 h20, Cancel
ifequal, DialogCaption, 0
gui, -caption
Gui, Show, h100 w200, %NoPassFound%
Return
GuiClose:
ButtonCancel:
gui, submit
gui, destroy
ButtonOK:
Gui, submit
gui, destroy
ifequal, RemRCONPass, 0
iniwrite, %RCONPass%, RCONPASS.INI, DATA, RCONPass
ifequal, RemPassState, 1
iniwrite, %PassState%, RCONPASS.INI, DATA, PassState
return
|
How do i make it so that when i click the "CheckBox" it will toggle show/hide password? while im in the gui
Now I need 2 edit it so it encrypts pass b4 saving & decrypts it when i use RCON command. |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1687
|
Posted: Fri Jun 10, 2005 5:12 am Post subject: |
|
|
the idea is to fill the vars 'text' & 'pw' and do 'gosub crypt'. text will contain encrypted text. to crypt pwd u'll have to put that into the 'text' var. _________________
 |
|
| Back to top |
|
 |
d3m0n1x
Joined: 04 May 2005 Posts: 16
|
Posted: Fri Jun 10, 2005 7:19 pm Post subject: |
|
|
Something like this
| Code: |
NoRCONPassFound = RCON
EnterRCONPass = Please enter New Password.
iniread, RemRCONPass, SETTINGS.INI,Remember,RCONPass,0
iniread, RCONPass, SETTINGS.INI, DATA, RCONPass, 00
iniread, RemRCONPassState, SETTINGS.INI, Remember, RCONPassState, 1
iniread, RCONPassState, SETTINGS.INI, DATA, RCONPassState, 1
ifexist SETTINGS.INI
return
ifnotexist SETTINGS.INI
ifequal, RCONPass, 00
RCONPass =
start:
Gui, Add, Checkbox, x185 y82 w20 h20 vRCONPassState Checked%RCONPassState%
Gui, Add, Text, x30 y10 w145 h20, %EnterRCONPass%
ifequal, RCONPassState, 1
Gui, Add, Edit, x20 y35 w160 h20 vRCONPass Password
ifequal, RCONPassState, 0
Gui, Add, Edit, x20 y40 w160 h20 vRCONPass
Gui, Add, Button, x35 y70 w50 h20, OK
Gui, Add, Button, x120 y70 w50 h20, Cancel
ifequal, DialogCaption, 0
gui, -caption
Gui, Show, h100 w200, %NoRCONPassFound%
Return
GuiClose:
ButtonCancel:
gui, submit
gui, destroy
return
ButtonOK:
Gui, submit
gui, destroy
Text = %RCONPass%
msgbox, %text%
pw = psw
Gosub, Crypt
msgbox, %Cipher%
Text = %Cipher%
pw = psw
;Gosub, Crypt
;msgbox, %Cipher%
ifequal, RemRCONPass, 0
iniwrite, %Cipher%, SETTINGS.INI, DATA, RCONPass
ifequal, RemRCONPassState, 1
iniwrite, %RCONPassState%, SETTINGS.INI, DATA, RCONPassState
Crypt:
BLines = %A_BatchLines%
SetBatchLines, -1
AutoTrim, Off
StringLen, PWLen, PW
Cipher =
Loop, 256
{
A = %A_Index%
A -= 1
Transform, Mod, Mod, %A%, %PWLen%
Mod += 1
StringMid, Chr, PW, %MOD%, 1
Transform, ASC, asc, %Chr%
Key%A% = %ASC%
sbox%A% = %A%
}
B = 0
Loop, 256
{
A = %A_Index%
A -= 1
StringTrimRight, tempsa, sbox%A%, 0
StringTrimRight, tempka, Key%A%, 0
tempB = %B%
tempB += %tempsa%
tempB += %tempka%
Transform, B, Mod, %tempB%, 256
StringTrimRight, tempsb, sbox%B%, 0
sbox%A% = %tempsb%
sbox%B% = %tempsa%
}
tempI =
J =
StringLen, TLen, Text
Loop, %TLen%
{
A = %A_Index%
tempI ++
Transform, I, Mod, %tempI%, 256
StringTrimRight, tempsi, sbox%I%, 0
Divd = %tempsi%
Divd += %J%
Transform, J, Mod, %Divd%, 256
StringTrimRight, tempsj, sbox%J%, 0
Divd = %tempsi%
Divd += %tempsj%
Transform, Mod, Mod, %Divd%, 256
StringTrimRight, K, sbox%Mod%, 0
StringMid, Chr, Text, %A%, 1
Transform, ASC, asc, %Chr%
Transform, CipherBy, bitxor, %Asc%, %K%
Transform, out, chr, %CipherBy%
Cipher = %Cipher%%out%
}
SetBatchLines, %BLines%
Return
$Numpad1::
Text = %RCONPass%
;msgbox, %text%
pw = psw
Gosub, Crypt
;msgbox, %Cipher%
Text = %Cipher%
pw = psw
;Gosub, Crypt
;msgbox, %Cipher%
Send,\
Sleep, 100
Send, rcon %Cipher% sv_players
return
|
Its not fully functional + its just missing a small portion of the code now I think but was wondering if u could tell me if I was on the right track & what u thought of the code so far.
I used yr Encryption formula, hope u dont mind. Couldn't have done it without yr help or without this great program. Also got bits & pieces of the code from other sources & am sorry if I didn't mention u in this or any other post.
PS: Still can't get the checkbox thing 2 work right.Can't toggle hide/show Password while gui is loaded.U know how 2 fix it  |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1687
|
Posted: Fri Jun 10, 2005 8:16 pm Post subject: |
|
|
i'm very bad at understanding other's codes, so here's some simple help:
| Code: | ; Generated using SmartGUI Creator 3.5
Gui, Add, Edit, x6 y17 w130 h20,
Gui, Add, Checkbox, x6 y47 w20 h30 g1 vstat,
Gui, Show, x158 y110 h85 w144, Generated using SmartGUI Creator 3.5
Return
1:
gui, submit, nohide
ifequal, stat, 1
guicontrol, +password, edit1
else
guicontrol, -password, edit1
return
GuiClose:
ExitApp |
_________________
 |
|
| Back to top |
|
 |
d3m0n1x
Joined: 04 May 2005 Posts: 16
|
Posted: Sat Jun 11, 2005 8:08 pm Post subject: |
|
|
Tx This code came in handy & it works.
Although u still have 2 click on the Edit Box after clicking CheckBox 4 it 2 Show/Hide Password it's still better than b4.  |
|
| Back to top |
|
 |
MIchael
Joined: 02 Mar 2005 Posts: 59
|
Posted: Tue Jun 14, 2005 12:36 pm Post subject: please rajat make your encryption for some more data! |
|
|
Hello rajat
your script is exactly what I need, but it only functions on small portions of text or files.
cant you alter it a bit to function on files of the size lets say 1 kbyte? or 700byte?
pleeeeeezzzze
Im too dumb to do it
ciao
MIchael |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1687
|
Posted: Wed Jun 15, 2005 5:53 am Post subject: |
|
|
Try the new script _________________
 |
|
| Back to top |
|
 |
TeknoMusicMan
Joined: 14 Apr 2005 Posts: 186 Location: Wisconsin, USA
|
Posted: Wed Jun 15, 2005 3:42 pm Post subject: |
|
|
Rajat did you update the actual encryption script or one of the reply's? _________________
"Make it idiot-proof, and someone will make a better idiot." |
|
| Back to top |
|
 |
MIchael
Joined: 02 Mar 2005 Posts: 59
|
Posted: Wed Jun 15, 2005 4:23 pm Post subject: enc |
|
|
He updated the encryption script!!!!!!!!!!!
really cool
Thanks a lot!
MIchael |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5031 Location: /b/
|
Posted: Wed Jun 15, 2005 4:27 pm Post subject: |
|
|
Yep, thanks for updating it Rajat.
It works great as a function too. |
|
| Back to top |
|
 |
d3m0n1x
Joined: 04 May 2005 Posts: 16
|
Posted: Fri Jun 17, 2005 12:36 am Post subject: |
|
|
I used the last version of the encryption code & added Gui's so I could save it already encrypted in a *.ini file + change the password from time to time.
I made 1 gui to type in & then through that gui encrypt/save the password the 1st time the aplication is run & another gui to decrypt/view/Change password.
My Problem is I mannaged 2 get it working with last version of the code but am having trouble with this version.
Can some1 help me plz?Tx  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|