Thread: Leet-2-1337
View Single Post
Old Aug 1st, 2005, 10:06 PM   #20
layer
Hobbyist Programmer
 
Join Date: Feb 2005
Posts: 112
Rep Power: 4 layer is on a distinguished road
You might want to check out this:
http://www.autoitscript.com/forum/in...90&#entry59190

Although that's not the best on the forum... There is a _completley_ different, shorter, more cleaner, more efficient way to do this using "StringSplit" and "StringReplace" with a For...Loop... It may take you a while to get down, well, I might just be stupid, but it should get you on your way. Here is one of my first scripts... It is the worse encryptor in the world But it's got the concept, that's wht counts!
#include <GUIConstants.au3>
GUICreate("AutoEncrypt", 400, 300)
GUISetState(@SW_SHOW)
$input = GUICtrlCreateInput("", 10, 50)
$outcome = GUICtrlCreateInput("", -1, 100)
GUICtrlCreateLabel("Type what you want Encrypted or Decrypted:", 10, 20)
GUICtrlCreateLabel("Results:", -1, 75)
$e = GUICtrlCreateButton("Encrypt", 10, 150)
$d = GUICtrlCreateButton("Decrypt", 10, 200)
While 1
   $get = GUIGetMsg()
   Select
      Case $get = $GUI_EVENT_CLOSE
         ExitLoop
      Case $get = $e
         $encrypted = Encrypt(GUICtrlRead($input))
         GUICtrlSetData($outcome, $encrypted, 1)
      Case $get = $d
         $encrypted = DEcrypt(GUICtrlRead($input))
         GUICtrlSetData($outcome, $encrypted, 1)
   EndSelect
WEnd


Func Encrypt($myen)
   $replace = StringSplit("&,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", ",")
   $keys = StringSplit("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,&", ",")
   For $i = 1 To 27
      $myen = StringReplace($myen, $keys[$i], $replace[$i])
   Next
   Return $myen
EndFunc   ;==>Encrypt 

Func DEcrypt($myen)
   $replace = StringSplit("&,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", ",")
   $keys = StringSplit("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,&", ",")
   For $i = 27 To 1 Step - 1
      $myen = StringReplace($myen, $replace[$i], $keys[$i])
   Next
   Return $myen
EndFunc   ;==>DEcrypt
Hope that helps!
layer is offline   Reply With Quote