Sign in to follow this  
Followers 0
PsaltyDS

Funky _StringEncrypt() Behavior...

17 posts in this topic

Demo script for _StringEncrypt() in help file:

CODE
#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

I'm trying to use _StringEncrypt() for the first time, and the script I wrote gets different results than the Demo with the same inputs. I set the encryption level to 2, the data is "Password-Check One Two Three" (without the quotes), and the password is "ThreeTwoOne0" (again, without the quotes).

Running the Demo script from the help file, which has a cute little GUI that reads the data and password from edit boxes, I get the following encrypted string (without quotes):

"F9BDCD6A4280A2FF84A9A146BA0761C84782C66440C37EF6CFF4A0E6C66D95A4D1A3F79A12B8328046B6E66E916F56D

E2B71055D826D2C9D8B19804871C0D95B24B6FC5F5505D376CA8A2C08A36A7C410BD29D0FBA9D65C07723BAA08A1C698AFDE

6A7C7F856B224E70FF7DFD42EACE6"

Now, if I run the following script, I get a different encrypted string:

#include <string.au3>

$PW = "ThreeTwoOne0"
$Data = "Password-Check One Two Three"
$EncData = _StringEncrypt(1, $Data, $PW, 2)
MsgBox(32, "Debug", "Encrypted Data:  " & $EncData)
$DecData = _StringEncrypt(0, $EncData, $PW, 2)
MsgBox(32, "Debug", "Decrypted Data:  " & $DecData)

Above script yields:

"BD3FC9920333902EFE5ADC783125B72B9F8DADC26284C3629797B9B4A934F0F3A25E680E8361596CEDC441F137D3DF5

649FB708FA0A0C839F1D8623528F6BA5A03763A452F7A80CE4992F6A4340CB32746DA8F536EFD4F7B978CA4850D9E974E342

C66E05EC45F3C047B7B07A3A66D76"

Why are they different? I can't trust the data I'm interested in to this function without a better understanding of what's up.

Changing the encryption levels to 1 gets me the following from the Demo:

"FABAB66F46F5A18187A8A34ABE001DBD46F1C31F39B67B81B489A592C01095D6D4A4F59B10BC33FE42B99D1E906C2BD

C2C707E57856D579C"

And this from my script:

"BE3CCB937848E82FFA55D905305FB2549CF8AAC61E8DC1629590BBC4AA33F7F5D92A6F0F80185B69E9B03D8730D1D95

7338D0D8AA7DBB23A"

If I change the password to simply "Password", then I get the same encrypted string from either script at level 1 or 2.

What are the limits on the data and/or passwords that are valid for the _StringEncrypt() function?

:)


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

Share this post


Link to post
Share on other sites



Contradiction in termino ?

I need to put encrypted strings in a file using a maintenance script, then reliably read and decrypt them from various other scripts. The two different scripts referenced in my original post both give the same self-consistent results, but different from each other. What would make the two calls to _StringEncrypt() give different results?

:)


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

Share this post


Link to post
Share on other sites

I need to put encrypted strings in a file using a maintenance script, then reliably read and decrypt them from various other scripts. The two different scripts referenced in my original post both give the same self-consistent results, but different from each other. What would make the two calls to _StringEncrypt() give different results?

:)

Is the Decrypted string equal to the Encrypted string when using the same Password ?


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

When i encrypt: (With the Demo)

I need to put encrypted strings in a file using a maintenance script, then reliably read and decrypt them from various other scripts. The two different scripts referenced in my original post both give the same self-consistent results, but different from each other. What would make the two calls to _StringEncrypt() give different results?

I get:

D909420819FC6C05DDE9CE0587105847A6547F13515AE386EAA33FC68DE13A7FF9AA88882AE0762A083079628617DCC33FD0

EE8C78894E55F44F2D222EC61D5C2FCB8D0B273063B48041B91432B5C784249DBFAC616A337760CC1F86E4ADB279692594A7

EFDA52407FFEC48BBCDD4756A1C20CB8283176F72BC5A192D8CC232897F37213B89EDFE0E96073F0D8C622F9BC9C99C5AE1F

42CB660083B68C5CA8A8368912A4E4631BAF1F1B941EF916DB9E35A5BCF581D88A81AAAD0CE71924DF3E49404B78D7CD79B8

F17BD1A35AA8A9EADBADBAEE9DC774734BBD4F20363ECB58145B2D7C6BAE173CA3988D2F556A9877BD3BB848AF76BA3C3F9C

FC14CDEE0F62EA4C1E77CEAB9E86A79E91D01A5133458F496F78559981CE654FD90A81AC83AE183461C0259F21BE9B1DF4F8

FB42FC382B41FA001E026FA995580352B2A8A5A0C658E0BFEC04846A93AF9402E8ED444F600DB6B79EECB9E6E2190ACB2B03

657FD61E6C91757A288C1DCDF9972A4252BE8616335C71DD0C08FDF48CA82B61B64AC3C7724D55F8EFAD593CD611515B9337

904C00FED846FFBEF6BA517EDB605277CF9CF3DE4BC449EBB4FD9D8B86F97CFCB9CE1B43DE08BCED3F4D030A63E7F78A4032

E58215A7BCBD56001A7662B6EE06F8D7D1D5A8A1618B4E4EBC7E355D4660D3B6C4020AB36CEE9C61D9A16ACBC9849528A27F

DDB8DEEC980136C2AA64320BDC7F447C1CFA6906D096B172F1132E4DDE277D16505C95F598AD3FC28BE93E7AFFDE8DF82892

775A09340F158413A3C74AAA9FF909F04020F54A2E2359CB6F585CB982092B3A61BE813AB91235B1B3F054EABDAA151C3E76

1BB119F49EDCC47A6D50E6A197AC213E7F8FB284BCAB4827A7B40BCA284071F25BC6DCE2D7C42E5CE3F97860BAECD3E29B6A

76FDAEC75789B890ECB3D16841CF1372F8CA875FDBAC308B66A2E111.

When i encrpyt it with your code i get:

D909420819FC6C05DDE9CE0587105847A6547F13515AE386EAA33FC68DE13A7FF9AA88882AE0762A083079628617DCC33FD0

EE8C78894E55F44F2D222EC61D5C2FCB8D0B273063B48041B91432B5C784249DBFAC616A337760CC1F86E4ADB279692594A7

EFDA52407FFEC48BBCDD4756A1C20CB8283176F72BC5A192D8CC232897F37213B89EDFE0E96073F0D8C622F9BC9C99C5AE1F

42CB660083B68C5CA8A8368912A4E4631BAF1F1B941EF916DB9E35A5BCF581D88A81AAAD0CE71924DF3E49404B78D7CD79B8

F17BD1A35AA8A9EADBADBAEE9DC774734BBD4F20363ECB58145B2D7C6BAE173CA3988D2F556A9877BD3BB848AF76BA3C3F9C

FC14CDEE0F62EA4C1E77CEAB9E86A79E91D01A5133458F496F78559981CE654FD90A81AC83AE183461C0259F21BE9B1DF4F8

FB42FC382B41FA001E026FA995580352B2A8A5A0C658E0BFEC04846A93AF9402E8ED444F600DB6B79EECB9E6E2190ACB2B03

657FD61E6C91757A288C1DCDF9972A4252BE8616335C71DD0C08FDF48CA82B61B64AC3C7724D55F8EFAD593CD611515B9337

904C00FED846FFBEF6BA517EDB605277CF9CF3DE4BC449EBB4FD9D8B86F97CFCB9CE1B43DE08BCED3F4D030A63E7F78A4032

E58215A7BCBD56001A7662B6EE06F8D7D1D5A8A1618B4E4EBC7E355D4660D3B6C4020AB36CEE9C61D9A16ACBC9849528A27F

DDB8DEEC980136C2AA64320BDC7F447C1CFA6906D096B172F1132E4DDE277D16505C95F598AD3FC28BE93E7AFFDE8DF82892

775A09340F158413A3C74AAA9FF909F04020F54A2E2359CB6F585CB982092B3A61BE813AB91235B1B3F054EABDAA151C3E76

1BB119F49EDCC47A6D50E6A197AC213E7F8FB284BCAB4827A7B40BCA284071F25BC6DCE2D7C42E5CE3F97860BAECD3E29B6A

76FDAEC75789B890ECB3D16841CF1372F8CA875FDBAC308B66A2E111

On a quick look, the both look the same: The password, The text, and the encryption level were the same...

Share this post


Link to post
Share on other sites

wouldnt the password have to be the same???

Yes, it does. The same input string will give different output strings with different passwords. When both scripts use "Password" for the password, the output strings are the same. When both scripts use "ThreeTwoOne0" (the last character is a numeral zero), they give different output strings.

That's my problem. I need to know what the rules are for passwords and/or strings (i.e. maybe no numerals allowed?). Also, if one script does it from a GUI control (like the Demo) and another script does it internally, are they going to get different results? And why?

:)


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

Share this post


Link to post
Share on other sites

When i encrypt: (With the Demo)

I get:

D909420819FC6C05DDE9CE0587105847A6547F13515AE386EAA33FC68DE13A7FF9AA88882AE0762A083079628617DCC33FD0

EE8C78894E55F44F2D222EC61D5C2FCB8D0B273063B48041B91432B5C784249DBFAC616A337760CC1F86E4ADB279692594A7

EFDA52407FFEC48BBCDD4756A1C20CB8283176F72BC5A192D8CC232897F37213B89EDFE0E96073F0D8C622F9BC9C99C5AE1F

42CB660083B68C5CA8A8368912A4E4631BAF1F1B941EF916DB9E35A5BCF581D88A81AAAD0CE71924DF3E49404B78D7CD79B8

F17BD1A35AA8A9EADBADBAEE9DC774734BBD4F20363ECB58145B2D7C6BAE173CA3988D2F556A9877BD3BB848AF76BA3C3F9C

FC14CDEE0F62EA4C1E77CEAB9E86A79E91D01A5133458F496F78559981CE654FD90A81AC83AE183461C0259F21BE9B1DF4F8

FB42FC382B41FA001E026FA995580352B2A8A5A0C658E0BFEC04846A93AF9402E8ED444F600DB6B79EECB9E6E2190ACB2B03

657FD61E6C91757A288C1DCDF9972A4252BE8616335C71DD0C08FDF48CA82B61B64AC3C7724D55F8EFAD593CD611515B9337

904C00FED846FFBEF6BA517EDB605277CF9CF3DE4BC449EBB4FD9D8B86F97CFCB9CE1B43DE08BCED3F4D030A63E7F78A4032

E58215A7BCBD56001A7662B6EE06F8D7D1D5A8A1618B4E4EBC7E355D4660D3B6C4020AB36CEE9C61D9A16ACBC9849528A27F

DDB8DEEC980136C2AA64320BDC7F447C1CFA6906D096B172F1132E4DDE277D16505C95F598AD3FC28BE93E7AFFDE8DF82892

775A09340F158413A3C74AAA9FF909F04020F54A2E2359CB6F585CB982092B3A61BE813AB91235B1B3F054EABDAA151C3E76

1BB119F49EDCC47A6D50E6A197AC213E7F8FB284BCAB4827A7B40BCA284071F25BC6DCE2D7C42E5CE3F97860BAECD3E29B6A

76FDAEC75789B890ECB3D16841CF1372F8CA875FDBAC308B66A2E111.

When i encrpyt it with your code i get:

D909420819FC6C05DDE9CE0587105847A6547F13515AE386EAA33FC68DE13A7FF9AA88882AE0762A083079628617DCC33FD0

EE8C78894E55F44F2D222EC61D5C2FCB8D0B273063B48041B91432B5C784249DBFAC616A337760CC1F86E4ADB279692594A7

EFDA52407FFEC48BBCDD4756A1C20CB8283176F72BC5A192D8CC232897F37213B89EDFE0E96073F0D8C622F9BC9C99C5AE1F

42CB660083B68C5CA8A8368912A4E4631BAF1F1B941EF916DB9E35A5BCF581D88A81AAAD0CE71924DF3E49404B78D7CD79B8

F17BD1A35AA8A9EADBADBAEE9DC774734BBD4F20363ECB58145B2D7C6BAE173CA3988D2F556A9877BD3BB848AF76BA3C3F9C

FC14CDEE0F62EA4C1E77CEAB9E86A79E91D01A5133458F496F78559981CE654FD90A81AC83AE183461C0259F21BE9B1DF4F8

FB42FC382B41FA001E026FA995580352B2A8A5A0C658E0BFEC04846A93AF9402E8ED444F600DB6B79EECB9E6E2190ACB2B03

657FD61E6C91757A288C1DCDF9972A4252BE8616335C71DD0C08FDF48CA82B61B64AC3C7724D55F8EFAD593CD611515B9337

904C00FED846FFBEF6BA517EDB605277CF9CF3DE4BC449EBB4FD9D8B86F97CFCB9CE1B43DE08BCED3F4D030A63E7F78A4032

E58215A7BCBD56001A7662B6EE06F8D7D1D5A8A1618B4E4EBC7E355D4660D3B6C4020AB36CEE9C61D9A16ACBC9849528A27F

DDB8DEEC980136C2AA64320BDC7F447C1CFA6906D096B172F1132E4DDE277D16505C95F598AD3FC28BE93E7AFFDE8DF82892

775A09340F158413A3C74AAA9FF909F04020F54A2E2359CB6F585CB982092B3A61BE813AB91235B1B3F054EABDAA151C3E76

1BB119F49EDCC47A6D50E6A197AC213E7F8FB284BCAB4827A7B40BCA284071F25BC6DCE2D7C42E5CE3F97860BAECD3E29B6A

76FDAEC75789B890ECB3D16841CF1372F8CA875FDBAC308B66A2E111

On a quick look, the both look the same: The password, The text, and the encryption level were the same...

Your resulting strings are much longer. Did you use the same data and passwords that I did? Do you still get the same result from both scripts if $Data = "Password-Check One Two Three", and $PW = "ThreeTwoOne0"?


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

Share this post


Link to post
Share on other sites

Your code: (password: ThreeTwoOne0, Encrpytion Level: 1, Text: Yes, Yes it does...)

BE4CCB977848EF59FF52DA78375EB3289CF5A8B51FFEC5679597BBC0AE36F482DD2A6B048016

Demo: Same Settings:

F27E3AF6E421B72F915584F07E5C4D83D8D628555BAAD4152F9B4E74A5A35451C7BBAD285D8D

That there is really weird... And if i omit the 0:

Your Code:

FACAB61246F5A48E82AFA235BD071AB84685C16A38C37F84B4F7A5EFC46AEFA1D0A488E910B2

Demo:

FACAB61246F5A48E82AFA235BD071AB84685C16A38C37F84B4F7A5EFC46AEFA1D0A488E910B2

EXACTLY THE SAME! What gives??

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

just tested with the example and your posted code and they both give the exact same result:

BD3FC9920333902EFE5ADC783125B72B9F8DADC26284C3629797B9B4A934F0F3A25E680E8361596CEDC441F137D3DF5649FB

708FA0A0C839F1D8623528F6BA5A03763A452F7A80CE4992F6A4340CB32746DA8F536EFD4F7B978CA4850D9E974E342C66E0

5EC45F3C047B7B07A3A66D76

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

just tested with the example and your posted code and they both give the exact same result:

BD3FC9920333902EFE5ADC783125B72B9F8DADC26284C3629797B9B4A934F0F3A25E680E8361596CEDC441F137D3DF5649FB

708FA0A0C839F1D8623528F6BA5A03763A452F7A80CE4992F6A4340CB32746DA8F536EFD4F7B978CA4850D9E974E342C66E0

5EC45F3C047B7B07A3A66D76

What password did you use? Does it seem like the the function behaves differently with/without the '0' on the end of the password?

Sorry, I missed your earlier post and didn't reply: "Is the Decrypted string equal to the Encrypted string when using the same Password ?"

Summary:

1) The same password is used for both the Demo and my script every time.

2) When the password used for both scripts is "Password", the output is the same from both scripts.

3) When the password used for both scripts is "ThreeTwoOne0", the output is different between the scripts.

4) In all cases, both scripts can decrypt their own output back to the original input string.

5) When using the same data, and same password (with the zero on the end) and getting a different result from the two scripts, they decrypt each other's strings as garbage.

:)


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

Share this post


Link to post
Share on other sites

What password did you use? Does it seem like the the function behaves differently with/without the '0' on the end of the password?

Sorry, I missed your earlier post and didn't reply: "Is the Decrypted string equal to the Encrypted string when using the same Password ?"

Summary:

1) The same password is used for both the Demo and my script every time.

2) When the password used for both scripts is "Password", the output is the same from both scripts.

3) When the password used for both scripts is "ThreeTwoOne0", the output is different between the scripts.

4) In all cases, both scripts can decrypt their own output back to the original input string.

5) When using the same data, and same password (with the zero on the end) and getting a different result from the two scripts, they decrypt each other's strings as garbage.

:)

I Used your String and Password and they both gave the same encrypted string.

$PW = "ThreeTwoOne0"

$Data = "Password-Check One Two Three"

The ouput changes when either the Password or the input string changes since they are both used to calculate the encrypted string and ant character is allowed to my knowledge ...


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

I Used your String and Password and they both gave the same encrypted string.

$PW = "ThreeTwoOne0"

$Data = "Password-Check One Two Three"

The ouput changes when either the Password or the input string changes since they are both used to calculate the encrypted string and ant character is allowed to my knowledge ...

I get that the output is different when either the data _OR_ password get changed. I really do.

It now appears that this is GUI issue with the Demo (at least as it runs on my box). Encryption Level and password character set are irrelevant, but password length is critical.

I've done more testing to see what's up here:

0) My machine is XP Pro SP2 with IE 6 SP2

1) Downloaded and installed Prod 3.2.2 and the latest SciTE (1.72), was at Beta 3.1.1.14 before.

2) Using the 3.2.2 (I don't think it changed, but just in case) version of the help file demo for _StringEncrypt().

3) If you keep the same password and just add one more character to the data, you get the same encrypted string plus four charcters (at encryption level 1). This is apparently normal.

4) If you add a character to both the data and password, you get length+4, but totally different strings.

5) When I use the same string for both the data and the password, the encrypted string stops being unique after 11 characters.

6) This symptom is NOT shown when using _StringEncrypt() by itself in a script, or if I script ControlSetText()\ControlClick() to automate the GUI in the Demo, only if I am manually operating the GUI and use more than 11 characters in the password.

7) The appearance is that if you type a password into the GUI of the Demo, it gets truncated to 11 characters.

8) Using ControlSetText() to set the password in the GUI allows correct usage of passwords longer than 11 char.

Sample Data:

When Data and Password are: ABCDEFGHIJK

The encrypted string is: AF4ADB1521FC356BC8E0B5BFAA41B5D0D229A4C20520

Same for manually typing the password in the GUI, inserting it with ControlSetText(), or running _StringEncrypt() directly.

When Data and Password are: ABCDEFGHIJKL

Encrypted string is: 0A52C9230E20B0D6452DA503252463ECA1E3C49C76163AB6 for _StringEncrypt() or ControlSetText(),

But is: AF4ADB1521FC356BC8E0B5BFAA41B5D0D229A4C20520D2D6 for manually typing password

When Data and Password are: ABCDEFGHIJKLM

Encrypted string is: C58B3C5572E02DCDA592753127ED65995CEED1A989F80AB28D96 for _StringEncrypt() or ControlSetText(),

But is: AF4ADB1521FC356BC8E0B5BFAA41B5D0D229A4C20520D2D639DC for manually typing password

So this is actually a GUI problem with the Demo script truncating the passwords at 11 characters, but not if you set the password by using ControlSetText(). The _StringEncrypt() function is not at fault, but the Demo needs tweaking.

Any ideas on the cause of the truncation? It is very consistent on my machine. Are others seeing the same?

:)

Edited by PsaltyDS

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

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

I get that the output is different when either the data _OR_ password get changed. I really do.

Where did you get the impression this was not the case ?

The password string is used to encrypt the data string so I agree that it changes when anything in either input value is changed.

:)

You are right, the input length of the string is limited, when typing the characters, to the width of the inputbox.

It looks like showing as Passwordchar(0x21) limits the number of characters to the inputbox width:

#include <guiconstants.au3>
; GUI and String stuff
$WinMain = GUICreate('Encryption tool', 400, 400)
; Creates main edit
$InputPass = GUICtrlCreateInput('', 5, 360, 100, 20, 0x21)
; Creates the password box with blured/centered input
GUICtrlCreateLabel('Password', 5, 385)
GUISetState()
; Shows window
$Test = ""
Do
    $Msg = GUIGetMsg()
    If $Test <> GUICtrlRead($InputPass) then 
        $Test = GUICtrlRead($InputPass)
        ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Test = ' & $Test & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    EndIf
Until $Msg = $GUI_EVENT_CLOSE ; Continue loop untill window is closed
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Where did you get the impression this was not the case ?

The password string is used to encrypt the data string so I agree that it changes when anything in either input value is changed.

:D

But... that's what I was saying from.... ARRRGH!!!! :)

You are right, the input length of the string is limited, when typing the characters, to the width of the inputbox.

It looks like showing as Passwordchar(0x21) limits the number of characters to the inputbox width:

#include <guiconstants.au3>
; GUI and String stuff
$WinMain = GUICreate('Encryption tool', 400, 400)
; Creates main edit
$InputPass = GUICtrlCreateInput('', 5, 360, 100, 20, 0x21)
; Creates the password box with blured/centered input
GUICtrlCreateLabel('Password', 5, 385)
GUISetState()
; Shows window
$Test = ""
Do
    $Msg = GUIGetMsg()
    If $Test <> GUICtrlRead($InputPass) then 
        $Test = GUICtrlRead($InputPass)
        ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Test = ' & $Test & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    EndIf
Until $Msg = $GUI_EVENT_CLOSE ; Continue loop untill window is closed
That's good to know. I'll need to experiment with it and test extra well when I get my intended scripts going.

Thanks!

: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

Share this post


Link to post
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
Sign in to follow this  
Followers 0