TJMaster Posted May 20, 2008 Share Posted May 20, 2008 So I have this file in progress but I can't figure out why it's not working completly... CODEinclude <GUIConstants.au3> #include <File.au3> #include <String.au3> GUICreate("Encryptor!", 320,120, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018); WS_EX_ACCEPTFILES $file = GUICtrlCreateInput ( "", 10, 5, 300, 20) GUICtrlSetState(-1,$GUI_DROPACCEPTED) $Password = GUICtrlCreateInput ("", 10, 52, 300, 20,$ES_PASSWORD) ; will not accept drag&drop files $btn = GUICtrlCreateButton ("Decrypt", 120, 80, 90, 35) GUICtrlCreateLabel('Password:', 10, 30) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn exitloop EndSelect Wend $Fdata = FileRead(GUICtrlRead($file)) MsgBox (4096, "drag drop file", $Fdata) MsgBox (4096, "Decrypted", GuiCtrlRead($Password)) $Pass2 = _StringEncrypt(1,GuiCtrlRead($Password),GuiCtrlRead($Password),3) MsgBox (4096, "Decrypted", $Pass2) $dat = _StringEncrypt(0, $Fdata, $Pass2,3) MsgBox (4096, "Decrypted", $dat) Now the problem lies somewhere in the last _StringEncrypt because when I try to decrypt the file I have encrypted it never turns out... but as you can see I have put several MsgBox's to test how the whole thing is coming together... and what happens is all the data is correct (while comparing it to what I used to encrypt it, which by the way was just the simple test encryptor thing) it just doesn't seem to want to make $dat the file I started with. Link to comment Share on other sites More sharing options...
enaiman Posted May 20, 2008 Share Posted May 20, 2008 lol - you have completely messed the parameters for _StringEncrypt and that's why you get such results. Here is the fixed code: $Fdata = FileRead(GUICtrlRead($file)) MsgBox (4096, "content", $Fdata) MsgBox (4096, "pwd", GuiCtrlRead($Password)) $Pass2 = _StringEncrypt(1,$Fdata,GuiCtrlRead($Password),3) MsgBox (4096, "Encrypted File Content", $Pass2) $dat = _StringEncrypt(0, $Pass2, GuiCtrlRead($Password),3) MsgBox (4096, "Decrypted", $dat) SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
TJMaster Posted May 20, 2008 Author Share Posted May 20, 2008 lol - you have completely messed the parameters for _StringEncrypt and that's why you get such results. Here is the fixed code: $Fdata = FileRead(GUICtrlRead($file)) MsgBox (4096, "content", $Fdata) MsgBox (4096, "pwd", GuiCtrlRead($Password)) $Pass2 = _StringEncrypt(1,$Fdata,GuiCtrlRead($Password),3) MsgBox (4096, "Encrypted File Content", $Pass2) $dat = _StringEncrypt(0, $Pass2, GuiCtrlRead($Password),3) MsgBox (4096, "Decrypted", $dat)oÝ÷ Ûú®¢×zYlyâ7öiè¶Úòx-¡éܯ*m¶Wéâg«e{'^r¼©¶+Sêh{h~+b²ÚÊò¦Ûaz¬³ +v)í¢+lzWæjG¬¶©jË0¢·l¶º'êè}Ê.®ÇÛajÚZ®Ü(®K²ÈhÂvò¶²èÅë-«l.¦Ø^¥«,Âݶ²²0ËazƦzÞ"ëvÚÊò¦ØÂ+aØî²×hzÉ÷öÛzkhvay«¢+ØÀÌØíÐô}MÑÉ¥¹¹ÉåÁÐ À°ÀÌØíAÍÌÈ°Õ¥ ÑɱI ÀÌØíAÍÍݽɤ°Ì¤ so that's what I'm trying to figure out...why? Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 20, 2008 Share Posted May 20, 2008 Well see I'm not trying to encrypt the file then immediatley decrypt it. The point of it is to encrypt the password into itself(makes the password stronger of course) and that part works (as shown by the Msgboxes that show up, the password they show is the same one I used to encrypt it with) it just doesn't seem to do the $dat = _StringEncrypt(0, $Pass2, GuiCtrlRead($Password),3) so that's what I'm trying to figure out...why? It depends on how the file data was encrypted, which you do not show. Did you triple-pass encrypt the password with itself and then use it to encrypt the original file data? What did that code look like? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
enaiman Posted May 20, 2008 Share Posted May 20, 2008 I'm not sure what doesn't work for you ... You may try this script (just created a couple functions) expandcollapse popup#include <GUIConstants.au3> #include <File.au3> #include <String.au3> GUICreate("Encryptor!", 320,120, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018); WS_EX_ACCEPTFILES $file = GUICtrlCreateInput ( "", 10, 5, 300, 20) GUICtrlSetState(-1,$GUI_DROPACCEPTED) $Password = GUICtrlCreateInput ("", 10, 52, 300, 20,$ES_PASSWORD) ; will not accept drag&drop files $btn = GUICtrlCreateButton ("Decrypt", 120, 80, 90, 35) GUICtrlCreateLabel('Password:', 10, 30) GUISetState () $Pass2 = "" $Pass2word = "" $dat = "" $decrypted = "" $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn exitloop EndSelect Wend $Fdata = FileRead(GUICtrlRead($file)) _EncryptFile () _DecryptFile() Func _EncryptFile () MsgBox (4096, "file", $Fdata) MsgBox (4096, "Passwd", GuiCtrlRead($Password)) _EncryptPassword(GuiCtrlRead($Password)) $dat = _StringEncrypt(1, $Fdata, $Pass2,3) MsgBox (4096, "Encrypted file with pass2", $dat) EndFunc Func _DecryptFile() _EncryptPassword(GuiCtrlRead($Password)) $decrypted = _StringEncrypt(0, $dat, $Pass2,3) MsgBox (4096, "Decrypted File", $decrypted) EndFunc Func _EncryptPassword($pwd) ;encrypts password with itself $Pass2 = _StringEncrypt(1,$pwd,$pwd,3) MsgBox (4096, "Encrypted passwd", $Pass2) EndFunc Func _DecryptPassword($pwd) ;decrypts password $Pass2word = _StringEncrypt(0,$Pass2,$pwd,3) MsgBox (4096, "Decrypted passwd", $Pass2word) EndFunc SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
TJMaster Posted May 21, 2008 Author Share Posted May 21, 2008 Thank you for your help, but I found my problem... It turns out that the problem was not with my program, it was with the program that I had used to encrypt it... See how I encrypted it as stated before was the programs little example script, and what happened was everytime I would copy the (Password X Password) back into the box in wouldn't read all of it making it not the same password I was try to decrypt it with... But like I said thanks for your effort... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now