Jump to content
Sign in to follow this  

Help with Hash

Recommended Posts


I am creating a script that changes important account information, including passwords and usernames, but I can't take the input from a user at runtime. I could get the script to work with the information included in variables, but that is a security risk we want to avoid. As far as I can tell, _Crypt_HashData or possible _Crypt_EncryptData are how I would go about this. I looked at the help file and I am struggling to understand the implementation. 

Do I need an external document with the info? That would present the same issue. Do I need to create the variable and then run the function in another script and then add it in? I am quite lost.

Could somone give me a basic step-by-step rundown? 

Share this post

Link to post
Share on other sites

You would use EncryptData to do what you want. What you're going to need is a crypt key that is used to encrypt and decrypt the information.

#include <Crypt.au3>

Global $sCryptKey = "EncryptThisData"
Global $sUsername = _Crypt_EncryptData("FakeUsername2016", $sCryptKey, $CALG_AES_256)
Global $sPassword = _Crypt_EncryptData("!FakePassword2016", $sCryptKey, $CALG_AES_256)

MsgBox("", "Encrypted Data", "Username: " & $sUsername & @CRLF & "Password: " & $sPassword)

$sUsername = BinaryToString(_Crypt_DecryptData($sUsername, $sCryptKey, $CALG_AES_256))
$sPassword = BinaryToString(_Crypt_DecryptData($sPassword, $sCryptKey, $CALG_AES_256))

MsgBox("", "Decrypt Data", "Username: " & $sUsername & @CRLF & "Password: " & $sPassword)


You could still store the information in encrypted variables and decrypt them when you need to check it. Your information will still be stored in variables but they'll at least be somewhat protected.

Another alternative is use a database to store all of your information (all of your account information). There is a way to use sqlite to encrypt all of your information and just have the script (user) access the database when it needs it. Prompting the user for the password to access the encrypted database. Wrong password should return an error. What this would mean is to access the database the user needs to give the proper password which is not saved inside of your program. I haven't used it before, I've only seen a couple of topics.

  • Like 1

Share this post

Link to post
Share on other sites

@Tumulus if you search the forum you will find where this has been discussed ad nauseam. In short, you cannot completely protect you script from anyone determined enough (or even half-heatedly interested enough) to get it. If you need that level of security, AutoIt is not the way to go. See some of the threads below as examples:





That being said, if you are interested in the encrypting functions they all come with pretty decent examples in the help file. What have you tried on your own? What is not working for you?


Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post

Link to post
Share on other sites

For password hashing:  secure is one-way encryption :sweating:

Currently I can not break it!
But it is not safe to check with AutoIt, it's too easy to be bypass!

Anyway, use MD5 or SHA1/512 to encryption for your password!


Share this post

Link to post
Share on other sites

Thanks guys. @InunoTaishou That is a nice little example there. the syntax makes a lot more sense, and from that I can grasp the implementation.

Also, I understand that AutoIT isn't the most secure, and we will look at some other solutions. Really though, the big goal is to not have the passwords show up in various i house admin tools that run using administrator credentials and the security risk isn't so great as to stop using them. Those threads were really interesting though, and made me aware of some risks that I did not understand. Good links.

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  

  • Similar Content

    • Theodoor
      By Theodoor
      I am trying to use the ControlClick in a "save as"-window to select the path of where to save the document.
      I found out that when in press the icon in front of the path, i select the path. So I am trying to press that button (i have attached a print screen of this window).
      While trying to figure out how i had to use the ControlClick, it said somewhere that i could us Au3Info to find out what title,... i should use with the ControlClick.
      The result of the Au3Info I have attached aswel.
      The ControlClick that i tried are these: (and none of these even move the mouse)
      ControlClick("[CLASS:ToolbarWindow32; INSTANCE:4]", "", "", "Left" ,1 ,10,10)
      ControlClick("[CLASS:ToolbarWindow32; INSTANCE:4]", "", "1001", "Left" ,1 ,10,10)
      ControlClick("[CLASS:ToolbarWindow32]", "", "", "Left" ,1 ,10,10)
      ControlClick("Save project as", "", "", "Left" ,1 ,10,10)
      I don't know what I am doing wrong.
      Should I use a controlID? is my windowtitle wrong?
      Can anyone help me?
      Thanks in advance,

    • Mercy
      By Mercy
      I need to add a column with data daily at the end of the column and calculate the difference between last two columns in put it in a seperate column. So i need to get the  position of the last column.
      Local $count = $oWorkbook2.Worksheets(1).UsedRange.Columns.Count MsgBox(0,"",$count) ; ***************************************************************************** ; Copy a single cell from another workbook. Pass the source range as object. ; ***************************************************************************** Local $oRange = $oWorkbook2.Worksheets(1).Range("A1:A15") _Excel_RangeCopyPaste($oWorkbook1.Worksheets(1), $oRange,"H1:H15") _Excel_RangeWrite($oWorkbook1, $oWorkbook1.Worksheets(1), "=C2-H2", "I2:I15", False) this code copies to a specific column H with a range 15. But i need to keep that column range to update automatically when columns are added.
    • Mercy
      By Mercy
      I inspect that Security tab in the webpage .I get the html element below:
      <td tabindex="-1" align="center" class="infaTabsetSimpleTabSetTop" nowrap="true" valign="middle" onfocus="app_details_browse.$47()">Security</td>
      If iam using the class name and trying to click the element. Iam getting "found" but cannot click as all the tab contains same class.
      If iam using the onfocus attribute which is different for every tab and trying to click the element, the element cannot be found.
      Local $oFound = "" Local $oBtns = _IETagNameGetCollection($oIE, "td") For $oBtn In $oBtns ;If String($oBtn.onfocus) ="app_details_browse.$47()" Then If String($oBtn.classname) = "infaTabsetSimpleTabSetTop" Then $oFound = $oBtn EndIf Next If IsObj($oFound) Then _IEAction ($oFound, "focus") _IEAction ($oFound, "click") MsgBox(16, "Success", "found") Else MsgBox(16, "Failed", "Not found.") EndIf

    • nacerbaaziz
      By nacerbaaziz
      I designed this code To help the blind
      Where screen readers users can  Identify the sefocus  item with audio files
      In this code i define some elements
      Unfortunately, I did not know how to define the other elements
      I am waiting for your initiative to  define the other elements
      Thank you in advance
      Global $CFocus = "" Func focus($window) Local $focusing = ControlGetFocus($window) Local $handle = ControlGetHandle($window, "", $focusing) If Not ($focusing = $CFocus) Then Switch StringTrimRight($focusing, 1) Case "button" If IsCheckBox($handle) Then play("checkBox") ElseIf IsRadio($handle) Then play("RadioButton") Else play("focus") EndIf $CFocus = $focusing Case "comboBox", "ListBox" play("list") $CFocus = $focusing Case "edit", "input" play("edit") $CFocus = $focusing Case Else play("focus") $CFocus = $focusing EndSwitch EndIf EndFunc ;==>focus Func IsCheckBox($ctrl_hwnd) $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE) Return BitAND($Style, $BS_CHECKBOX) = $BS_CHECKBOX EndFunc ;==>IsCheckBox Func IsRadio($ctrl_hwnd) $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE) Return BitAND($Style, $BS_AUTORADIOBUTTON) = $BS_AUTORADIOBUTTON EndFunc ;==>IsRadio Func play($name, $wait = 0) Local Const $SND_RESOURCE = 0x00040004 Local Const $SND_ASYNC = 1 ; Play the file - the script will pause as it sounds If $wait = 0 Then DllCall("winmm.dll", "int", "PlaySound", "str", $name, "hwnd", 0, "int", BitOR($SND_RESOURCE, $SND_ASYNC)) Else DllCall("winmm.dll", "int", "PlaySound", "str", $name, "hwnd", 0, "int", $SND_RESOURCE) EndIf Return 1 EndFunc ;==>play  
    • Valnurat
      By Valnurat
      I have a splashscreen I want to add to my application, but after I compile it and I run the exe file th esplashscreen is not there.
      How do I combine the splashscreen?

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.