Zero0 Posted May 16, 2020 Share Posted May 16, 2020 If it is the Case standard, why does it still continue to encrypt? thanks expandcollapse popup#include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Crypt.au3> $sString1 = "ABC" $sString2 = "123" $Form1 = GUICreate("Form1", 528, 145) $Input1 = GUICtrlCreateInput("", 8, 64, 504, 21, $es_readonly) $Input2 = GUICtrlCreateInput("", 8, 104, 504, 21, $es_readonly) GUICtrlSetData($Input1, $sString1) GUICtrlSetData($Input2, $sString2) $Combo1 = GUICtrlCreateCombo("standard", 8, 16, 504, 25) GUICtrlSetData($Combo1, 'MD2|MD4|MD5|') GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Combo1 Switch GUICtrlRead($Combo1) Case "MD2" $g_iAlgorithm = $CALG_MD2 Case "MD4" $g_iAlgorithm = $CALG_MD4 Case "MD5" $g_iAlgorithm = $CALG_MD5 Case "standard" _Reset() EndSwitch _Crypt_Startup() $Input1Read = GUICtrlRead($Input1) $Input2Read = GUICtrlRead($Input2) GUICtrlSetData($Input1, StringTrimLeft(_Crypt_HashData($Input1Read, $g_iAlgorithm), 2)) GUICtrlSetData($Input2, StringTrimLeft(_Crypt_HashData($Input2Read, $g_iAlgorithm), 2)) _Crypt_Shutdown() EndSwitch WEnd Func _Reset() GUICtrlSetData($Input1, "") GUICtrlSetData($Input2, "") GUICtrlSetData($Input1, $sString1) GUICtrlSetData($Input2, $sString2) EndFunc ;==>_Reset Link to comment Share on other sites More sharing options...
paw Posted May 16, 2020 Share Posted May 16, 2020 (edited) You immediately encrypt after calling _Reset() (after your first EndSwitch). You could make crypt a function and call it in each case except for "standard". Like this While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Combo1 Switch GUICtrlRead($Combo1) Case "MD2" $g_iAlgorithm = $CALG_MD2 _Encrypt() Case "MD4" $g_iAlgorithm = $CALG_MD4 _Encrypt() Case "MD5" $g_iAlgorithm = $CALG_MD5 _Encrypt() Case "standard" _Reset() EndSwitch EndSwitch WEnd Func _Encrypt() _Crypt_Startup() $Input1Read = GUICtrlRead($Input1) $Input2Read = GUICtrlRead($Input2) GUICtrlSetData($Input1, StringTrimLeft(_Crypt_HashData($Input1Read, $g_iAlgorithm), 2)) GUICtrlSetData($Input2, StringTrimLeft(_Crypt_HashData($Input2Read, $g_iAlgorithm), 2)) _Crypt_Shutdown() EndFunc ;==>_encrypt Edited May 16, 2020 by paw Zero0 1 Link to comment Share on other sites More sharing options...
Zero0 Posted May 16, 2020 Author Share Posted May 16, 2020 (edited) Thanks I understood for the answer. There is one more problem! For example, choosing md2 is ok, when choosing md5 it crypt the md2 code, so I don't want it to crypt one another. I always want to crypt data from the $sString1 and $sString1 variable I set. Edit: As a workaround, after adding _Reset() again after Case $Combo1 Case $Combo1 _Reset() Switch GUICtrlRead($Combo1) Case "MD2" $g_iAlgorithm = $CALG_MD2 _Encrypt() Case "MD4" $g_iAlgorithm = $CALG_MD4 _Encrypt() Case "MD5" $g_iAlgorithm = $CALG_MD5 _Encrypt() Case "standard" _Reset() EndSwitch Edited May 16, 2020 by Zero0 Editing return Link to comment Share on other sites More sharing options...
spudw2k Posted May 19, 2020 Share Posted May 19, 2020 The reason is, you are capturing the contents of the input fields, then hashing that. So it just keeps rehashing the contents over and over. If you only want it hash ABC and 123 every time, then hash $sString1 and $sString2 respectively instead of reading the controls contents. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF 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