Jump to content

_StringEncrypt is returning ""


Recommended Posts

  • Replies 208
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Does the helpfile example fail for you?

#include <guiconstants.au3>
#include <string.au3>
; GUI and String stuff
$WinMain = GuiCreate('Encryption tool', 400, 400)
; Creates window
$EditText = GuiCtrlCreateEdit('',5,5,380,350)
; Creates main edit
$InputPass = GuiCtrlCreateInput('',5,360,100,20, 0x21)
; Creates the password box with blured/centered input
$InputLevel = GuiCtrlCreateInput(1, 110, 360, 50, 20, 0x2001)
$UpDownLevel = GUICtrlSetLimit(GuiCtrlCreateUpDown($inputlevel),10,1)
; These two make the level input with the Up|Down ability
$EncryptButton = GuiCtrlCreateButton('Encrypt', 170, 360, 105, 35)
; Encryption button
$DecryptButton = GuiCtrlCreateButton('Decrypt', 285, 360, 105, 35)
; Decryption button
GUICtrlCreateLabel('Password', 5, 385)
GuiCtrlCreateLabel('Level',110,385)
; Simple text labels so you know what is what
GuiSetState()
; Shows window

Do
   $Msg = GuiGetMsg()
   If $msg = $EncryptButton Then
      GuiSetState(@SW_DISABLE,$WinMain); Stops you from changing anything
      $string = GuiCtrlRead($EditText); Saves the editbox for later
      GUICtrlSetData($EditText,'Please wait while the text is Encrypted/Decrypted.'); Friendly message
      GuiCtrlSetData($EditText,_StringEncrypt(1,$string,GuiCtrlRead($InputPass),GuiCtrlRead($InputLevel)))
     ; Calls the encryption. Sets the data of editbox with the encrypted string
     ; The encryption starts with 1/0 to tell it to encrypt/decrypt
     ; The encryption then has the string that we saved for later from edit box
     ; It then reads the password box & Reads the level box
      GuiSetState(@SW_ENABLE,$WinMain); This turns the window back on
   EndIf
   If $msg = $DecryptButton Then
      GuiSetState(@SW_DISABLE,$WinMain); Stops you from changing anything
      $string = GuiCtrlRead($EditText); Saves the editbox for later
      GUICtrlSetData($EditText,'Please wait while the text is Encrypted/Decrypted.'); Friendly message
      GuiCtrlSetData($EditText,_StringEncrypt(0,$string,GuiCtrlRead($InputPass),GuiCtrlRead($InputLevel)))
     ; Calls the encryption. Sets the data of editbox with the encrypted string
     ; The encryption starts with 1/0 to tell it to encrypt/decrypt
     ; The encryption then has the string that we saved for later from edit box
     ; It then reads the password box & Reads the level box
      GuiSetState(@SW_ENABLE,$WinMain); This turns the window back on
   EndIf
Until $msg = $GUI_EVENT_CLOSE; Continue loop untill window is closed
Link to comment
Share on other sites

Yes.. it returned an empty string too.. Please help T.T urgent

Your code as posted works fine for me using the latest versions of AutoIt.

Environment = 3.2.10.0 under  WIN_XP/Service Pack 2 X86
_StringEncrypt(1, "test", "test", 1) = 10249CAA2F88B4EB

Environment = 3.2.11.0 under  WIN_XP/Service Pack 2 X86
_StringEncrypt(1, "test", "test", 1) = 10249CAA2F88B4EB

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

But it returned a blank string for me .. why is it so ?

Could be a range of reasons. Looking at the actual function, I cannot see any reason for it to fail. Did you happen to catch the @error code?
Link to comment
Share on other sites

#Include <string.au3>
$encrypt = _StringEncrypt(1, "test", "test")
MsgBox(0, "", @Error & "/" & @extended)
$decrypt = _StringEncrypt(0, $encrypt, "test")
MsgBox(0, "", @Error & "/" & @extended)

First msgbox returned "0/0"

Second returned "1/0"

Whats the problem ?

I dont think its the problem with String.au3 become i replaced a working one but it still fail.

Edited by CrazeStar1074
Link to comment
Share on other sites

Do it this way and post the results:

#Include <string.au3>
$encrypt = _StringEncrypt(1, "test", "test")
ConsoleWrite("Debug: $encrypt = " & $encrypt & "  @error = " & @error & "  @extended = " & @extended & @LF)
$decrypt = _StringEncrypt(0, $encrypt, "test")
ConsoleWrite("Debug: $dencrypt = " & $decrypt & "  @error = " & @error & "  @extended = " & @extended & @LF)

I get:

>Running:(3.2.10.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Program Files\AutoIt3\Scripts\Test_2.au3"  
Debug: $encrypt = 10249CAA2F88B4EB  @error = 0  @extended = 0
Debug: $dencrypt = test  @error = 0  @extended = 0
+>07:52:18 AutoIT3.exe ended.rc:0

:D

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

I dont know how ConsoleWrite works so i did it this way

#Include <string.au3>
$encrypt = _StringEncrypt(1, "test", "test")
Msgbox(0, "", "Debug: $encrypt = " & $encrypt & "  @error = " & @error & "  @extended = " & @extended & @LF)
$decrypt = _StringEncrypt(0, $encrypt, "test")
Msgbox(0, "", "Debug: $dencrypt = " & $decrypt & "  @error = " & @error & "  @extended = " & @extended & @LF)
ClipPut("Debug: $encrypt = " & $encrypt & "  @error = " & @error & "  @extended = " & @extended & @CRLF & "Debug: $dencrypt = " & $decrypt & "  @error = " & @error & "  @extended = " & @extended & @LF & "")

and it returned :

Debug: $encrypt = @error = 0 @extended = 0

Debug: $dencrypt = @error = 0 @extended = 0

Link to comment
Share on other sites

I dont know how ConsoleWrite works so i did it this way

#Include <string.au3>
$encrypt = _StringEncrypt(1, "test", "test")
Msgbox(0, "", "Debug: $encrypt = " & $encrypt & "  @error = " & @error & "  @extended = " & @extended & @LF)
$decrypt = _StringEncrypt(0, $encrypt, "test")
Msgbox(0, "", "Debug: $dencrypt = " & $decrypt & "  @error = " & @error & "  @extended = " & @extended & @LF)
ClipPut("Debug: $encrypt = " & $encrypt & "  @error = " & @error & "  @extended = " & @extended & @CRLF & "Debug: $dencrypt = " & $decrypt & "  @error = " & @error & "  @extended = " & @extended & @LF & "")

and it returned :

Debug: $encrypt = @error = 0 @extended = 0

Debug: $dencrypt = @error = 0 @extended = 0

ConsoleWrite() just writes to the scrolling console pane of the SciTE window. I prefer it to MsgBox for debug because I don't have to respond to a string of annoying pop ups.

You are not getting a string back from _StringEncrypt(). Have you modified the string.au3 UDF in any way? What version of AutoIt are you running? Run the code the way I posted it (with ConsoleWrite) and post all of the output in the SciTE console pane, including any errors and the lines that report program versions.

:D

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

1 ) Nop.. i did not modified any of the includes file..

2 ) v3.2.10.0

3 )

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\user\Desktop\StringEncrypt.au3"

Debug: $encrypt = @error = 0 @extended = 0

Debug: $dencrypt = @error = 1 @extended = 0

>Exit code: 0 Time: 1.087

Link to comment
Share on other sites

1 ) Nop.. i did not modified any of the includes file..

2 ) v3.2.10.0

3 )

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\user\Desktop\StringEncrypt.au3"

Debug: $encrypt = @error = 0 @extended = 0

Debug: $dencrypt = @error = 1 @extended = 0

>Exit code: 0 Time: 1.087

Why are you avoiding running this from SciTE and posting the output from that...? Please run it from SciTE with F5 and copy/paste/post the contents of the console pane at the bottom of the SciTE window (not just the "Debug:" lines).

:D

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

-.- thats what i get after pressing F5 ..

You want the result of SyntaxCheck prod ?

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\user\Desktop\FTP_Example.au3"  
Debug: $encrypt =   @error = 0  @extended = 0
Debug: $dencrypt =   @error = 1  @extended = 0
>Exit code: 0   Time: 1.379
Link to comment
Share on other sites

-.- thats what i get after pressing F5 ..

You want the result of SyntaxCheck prod ?

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\user\Desktop\FTP_Example.au3"  
Debug: $encrypt =   @error = 0  @extended = 0
Debug: $dencrypt =   @error = 1  @extended = 0
>Exit code: 0   Time: 1.379
Like this:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\francisb\Desktop\msn_test\tester.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams 
+>16:39:49 Starting AutoIt3Wrapper v.1.9.5.6    Environment(Language:0409  Keyboard:00000409  OS:WIN_XP/Service Pack 2  CPU:X86)
>Running AU3Check (1.54.10.0)  from:C:\Program Files\AutoIt3
+>16:39:49 AU3Check ended.rc:0
>Running:(3.2.10.0):C:\Program Files\AutoIt

All of it.

Link to comment
Share on other sites

If this helps..

>"E:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "E:\Documents and Settings\Mike Jin\桌面\GUIInputSetOnlyNumbers_Example.au3" /autoit3dir "E:\Program Files\AutoIt3" /UserParams   
+>22:37:06 Starting AutoIt3Wrapper v.1.9.4
>Running AU3Check (1.54.10.0)  from:E:\Program Files\AutoIt3
+>22:37:06 AU3Check ended.rc:0
>Running:(3.2.10.0):E:\Program Files\AutoIt3\autoit3.exe "E:\Documents and Settings\Mike Jin\桌面\GUIInputSetOnlyNumbers_Example.au3" 
Debug: $encrypt =   @error = 0  @extended = 0
Debug: $dencrypt =   @error = 1  @extended = 0
+>22:37:07 AutoIT3.exe ended.rc:0
+>22:37:08 AutoIt3Wrapper Finished
>Exit code: 0   Time: 2.917
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...