marcusvdt Posted 2 hours ago Share Posted 2 hours ago Hi 🙂 For some unknown reason, the same code behaves differently if I run it multiple times. Currently this is the most secure software ever as it seems like I must have the correct value for $myPASS and a lot of luck too 😁 The relevant part of the code: expandcollapse popup#include <Crypt.au3> #include <MsgBoxConstants.au3> global $special='[@#$%^&+=]' ConsoleWrite(@CRLF &@CRLF &'@@ Debug(' & @ScriptLineNumber & ') : TEST1' & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Local $StringToEncrypt="LA.Alalalala123123@" global $myPASS="LA.Alalalala123123@" $test=ENCRYPTit($StringToEncrypt,$myPASS) $test=DECRYPTit($test, $myPASS) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console ConsoleWrite(@CRLF &@CRLF &'@@ Debug(' & @ScriptLineNumber & ') : TEST2' & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $StringToEncrypt="AA.Alalalala123123@" $myPASS="LA.Alalalala123123@" $test=ENCRYPTit($StringToEncrypt,$myPASS) $test=DECRYPTit($test, $myPASS) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Func ENCRYPTit($StringToEncrypt,$myPASS) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : ENCRYPT' & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $myPASS = ' & $myPASS & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $StringToEncrypt = ' & $StringToEncrypt & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Local $hKey = _Crypt_DeriveKey(Binary(LOGIN($myPASS)), $CALG_AES_256,$CALG_SHA_512) ; Declare a password string and algorithm to create a cryptographic key. ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Binary($hKey) = ' & Binary($hKey) & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console local $encrypted = _Crypt_EncryptData($StringToEncrypt, Binary($hKey), $CALG_AES_256) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : binary($encrypted) = ' & binary($encrypted) & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $encrypted = ' & $encrypted & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console _Crypt_DestroyKey($hKey) ; Destroy the cryptographic key. return Binary($encrypted) EndFunc Func DECRYPTit($StringToDecrypt, $myPASS) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : DECRYPT' & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $myPASS = ' & $myPASS & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $StringToDecrypt = ' & $StringToDecrypt & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Local $hKey = _Crypt_DeriveKey(Binary(LOGIN($myPASS)), $CALG_AES_256, $CALG_SHA_512) ; Declare a password string and algorithm to create a cryptographic key. ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Binary($hKey) = ' & Binary($hKey) & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Local $decrypted = _Crypt_DecryptData($StringToDecrypt, Binary($hKey), $CALG_AES_256) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : binary($decrypted) = ' & Binary($decrypted) & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $decrypted = ' & $decrypted & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console _Crypt_DestroyKey($hKey) ; Destroy the cryptographic key. Return BinaryToString(binary($decrypted)) EndFunc ;==>DECRYPT Results when it fails: expandcollapse popup@@ Debug(6) : TEST1 >Error code: 0 @@ Debug(21) : ENCRYPT >Error code: 0 @@ Debug(22) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(23) : $StringToEncrypt = LA.Alalalala123123@ >Error code: 0 @@ Debug(25) : Binary($hKey) = 0xC0E709E4EC010000 >Error code: 0 @@ Debug(27) : binary($encrypted) = 0x13756D1C3845579E5CAE2065B087E3661165445612CFE4A40E18372BCA170DB1 >Error code: 0 @@ Debug(28) : $encrypted = 0x13756D1C3845579E5CAE2065B087E3661165445612CFE4A40E18372BCA170DB1 >Error code: 0 @@ Debug(35) : DECRYPT >Error code: 0 @@ Debug(36) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(37) : $StringToDecrypt = 0x13756D1C3845579E5CAE2065B087E3661165445612CFE4A40E18372BCA170DB1 >Error code: 0 @@ Debug(39) : Binary($hKey) = 0xC0E709E4EC010000 >Error code: 0 @@ Debug(41) : binary($decrypted) = 0x4C412E416C616C616C616C6131323331323340 >Error code: 0 @@ Debug(42) : $decrypted = 0x4C412E416C616C616C616C6131323331323340 >Error code: 0 @@ Debug(11) : $test = LA.Alalalala123123@ >Error code: 0 @@ Debug(13) : TEST2 >Error code: 0 @@ Debug(21) : ENCRYPT >Error code: 0 @@ Debug(22) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(23) : $StringToEncrypt = AA.Alalalala123123@ >Error code: 0 @@ Debug(25) : Binary($hKey) = 0xC0E709E4EC010000 >Error code: 0 @@ Debug(27) : binary($encrypted) = 0x0F2E2D69E210E72B7BEC05CF7E628A7D2D872D8F38B578AD046891BCBB8B044B >Error code: 0 @@ Debug(28) : $encrypted = 0x0F2E2D69E210E72B7BEC05CF7E628A7D2D872D8F38B578AD046891BCBB8B044B >Error code: 0 @@ Debug(35) : DECRYPT >Error code: 0 @@ Debug(36) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(37) : $StringToDecrypt = 0x0F2E2D69E210E72B7BEC05CF7E628A7D2D872D8F38B578AD046891BCBB8B044B >Error code: 0 @@ Debug(39) : Binary($hKey) = 0x40F209E4EC010000 >Error code: 0 @@ Debug(41) : binary($decrypted) = 0xFFFFFFFF >Error code: 0 @@ Debug(42) : $decrypted = -1 >Error code: 70 @@ Debug(18) : $test = ÿÿÿÿ >Error code: 0 +>19:17:42 AutoIt3.exe ended.rc:0 +>19:17:43 AutoIt3Wrapper Finished. >Exit code: 0 Time: 4.54 Another different failed try without any change in the code: expandcollapse popup@@ Debug(6) : TEST1 >Error code: 0 @@ Debug(21) : ENCRYPT >Error code: 0 @@ Debug(22) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(23) : $StringToEncrypt = LA.Alalalala123123@ >Error code: 0 @@ Debug(25) : Binary($hKey) = 0xA0E3B88EAA010000 >Error code: 0 @@ Debug(27) : binary($encrypted) = 0x8717DBB452965C093FD48B7B14C9DA4803A8D60A9189DBE97228503B3D098653 >Error code: 0 @@ Debug(28) : $encrypted = 0x8717DBB452965C093FD48B7B14C9DA4803A8D60A9189DBE97228503B3D098653 >Error code: 0 @@ Debug(35) : DECRYPT >Error code: 0 @@ Debug(36) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(37) : $StringToDecrypt = 0x8717DBB452965C093FD48B7B14C9DA4803A8D60A9189DBE97228503B3D098653 >Error code: 0 @@ Debug(39) : Binary($hKey) = 0x20F0B88EAA010000 >Error code: 0 @@ Debug(41) : binary($decrypted) = 0xFFFFFFFF >Error code: 0 @@ Debug(42) : $decrypted = -1 >Error code: 70 @@ Debug(11) : $test = ÿÿÿÿ >Error code: 0 @@ Debug(13) : TEST2 >Error code: 0 @@ Debug(21) : ENCRYPT >Error code: 0 @@ Debug(22) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(23) : $StringToEncrypt = AA.Alalalala123123@ >Error code: 0 @@ Debug(25) : Binary($hKey) = 0x20E1B88EAA010000 >Error code: 0 @@ Debug(27) : binary($encrypted) = 0xC993721623667138C0A2C523163694C08D35BDB55682AC3979AFF804CF914592 >Error code: 0 @@ Debug(28) : $encrypted = 0xC993721623667138C0A2C523163694C08D35BDB55682AC3979AFF804CF914592 >Error code: 0 @@ Debug(35) : DECRYPT >Error code: 0 @@ Debug(36) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(37) : $StringToDecrypt = 0xC993721623667138C0A2C523163694C08D35BDB55682AC3979AFF804CF914592 >Error code: 0 @@ Debug(39) : Binary($hKey) = 0xA0DEB88EAA010000 >Error code: 0 @@ Debug(41) : binary($decrypted) = 0xFFFFFFFF >Error code: 0 @@ Debug(42) : $decrypted = -1 >Error code: 70 @@ Debug(18) : $test = ÿÿÿÿ >Error code: 0 +>19:25:53 AutoIt3.exe ended.rc:0 +>19:25:53 AutoIt3Wrapper Finished. >Exit code: 0 Time: 3.022 Another try and different result again! expandcollapse popup@@ Debug(6) : TEST1 >Error code: 0 @@ Debug(21) : ENCRYPT >Error code: 0 @@ Debug(22) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(23) : $StringToEncrypt = LA.Alalalala123123@ >Error code: 0 @@ Debug(25) : Binary($hKey) = 0xC0EBD63F03020000 >Error code: 0 @@ Debug(27) : binary($encrypted) = 0x6916F4099537D771E17B8C970134D14EF369DEFA5937BBD5A995425023730D37 >Error code: 0 @@ Debug(28) : $encrypted = 0x6916F4099537D771E17B8C970134D14EF369DEFA5937BBD5A995425023730D37 >Error code: 0 @@ Debug(35) : DECRYPT >Error code: 0 @@ Debug(36) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(37) : $StringToDecrypt = 0x6916F4099537D771E17B8C970134D14EF369DEFA5937BBD5A995425023730D37 >Error code: 0 @@ Debug(39) : Binary($hKey) = 0x40EDD63F03020000 >Error code: 0 @@ Debug(41) : binary($decrypted) = 0xFFFFFFFF >Error code: 0 @@ Debug(42) : $decrypted = -1 >Error code: 70 @@ Debug(11) : $test = ÿÿÿÿ >Error code: 0 @@ Debug(13) : TEST2 >Error code: 0 @@ Debug(21) : ENCRYPT >Error code: 0 @@ Debug(22) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(23) : $StringToEncrypt = AA.Alalalala123123@ >Error code: 0 @@ Debug(25) : Binary($hKey) = 0xC0EBD63F03020000 >Error code: 0 @@ Debug(27) : binary($encrypted) = 0xB1FD73FE621D58CFE20D18386424EF788D4ED0528B9A95937C5FCABEE5BFB0F2 >Error code: 0 @@ Debug(28) : $encrypted = 0xB1FD73FE621D58CFE20D18386424EF788D4ED0528B9A95937C5FCABEE5BFB0F2 >Error code: 0 @@ Debug(35) : DECRYPT >Error code: 0 @@ Debug(36) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(37) : $StringToDecrypt = 0xB1FD73FE621D58CFE20D18386424EF788D4ED0528B9A95937C5FCABEE5BFB0F2 >Error code: 0 @@ Debug(39) : Binary($hKey) = 0xC0EBD63F03020000 >Error code: 0 @@ Debug(41) : binary($decrypted) = 0x41412E416C616C616C616C6131323331323340 >Error code: 0 @@ Debug(42) : $decrypted = 0x41412E416C616C616C616C6131323331323340 >Error code: 0 @@ Debug(18) : $test = AA.Alalalala123123@ >Error code: 0 +>19:29:06 AutoIt3.exe ended.rc:0 +>19:29:07 AutoIt3Wrapper Finished. >Exit code: 0 Time: 2.95 Then magically, after being insistent by running the same code again, it works: expandcollapse popup@@ Debug(6) : TEST1 >Error code: 0 @@ Debug(21) : ENCRYPT >Error code: 0 @@ Debug(22) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(23) : $StringToEncrypt = LA.Alalalala123123@ >Error code: 0 @@ Debug(25) : Binary($hKey) = 0x1095A7F58D010000 >Error code: 0 @@ Debug(27) : binary($encrypted) = 0x5DBA6E0DD474E2C394E9ADDD688C45333ABD5CD125510849B8CD60575015C146 >Error code: 0 @@ Debug(28) : $encrypted = 0x5DBA6E0DD474E2C394E9ADDD688C45333ABD5CD125510849B8CD60575015C146 >Error code: 0 @@ Debug(35) : DECRYPT >Error code: 0 @@ Debug(36) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(37) : $StringToDecrypt = 0x5DBA6E0DD474E2C394E9ADDD688C45333ABD5CD125510849B8CD60575015C146 >Error code: 0 @@ Debug(39) : Binary($hKey) = 0x1095A7F58D010000 >Error code: 0 @@ Debug(41) : binary($decrypted) = 0x4C412E416C616C616C616C6131323331323340 >Error code: 0 @@ Debug(42) : $decrypted = 0x4C412E416C616C616C616C6131323331323340 >Error code: 0 @@ Debug(11) : $test = LA.Alalalala123123@ >Error code: 0 @@ Debug(13) : TEST2 >Error code: 0 @@ Debug(21) : ENCRYPT >Error code: 0 @@ Debug(22) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(23) : $StringToEncrypt = AA.Alalalala123123@ >Error code: 0 @@ Debug(25) : Binary($hKey) = 0x1095A7F58D010000 >Error code: 0 @@ Debug(27) : binary($encrypted) = 0xAA6F0C080AB9D2582FFDB980409286CF25DA2CAA2D62995C2EEE0F82205FBDEF >Error code: 0 @@ Debug(28) : $encrypted = 0xAA6F0C080AB9D2582FFDB980409286CF25DA2CAA2D62995C2EEE0F82205FBDEF >Error code: 0 @@ Debug(35) : DECRYPT >Error code: 0 @@ Debug(36) : $myPASS = LA.Alalalala123123@ >Error code: 0 @@ Debug(37) : $StringToDecrypt = 0xAA6F0C080AB9D2582FFDB980409286CF25DA2CAA2D62995C2EEE0F82205FBDEF >Error code: 0 @@ Debug(39) : Binary($hKey) = 0x1095A7F58D010000 >Error code: 0 @@ Debug(41) : binary($decrypted) = 0x41412E416C616C616C616C6131323331323340 >Error code: 0 @@ Debug(42) : $decrypted = 0x41412E416C616C616C616C6131323331323340 >Error code: 0 @@ Debug(18) : $test = AA.Alalalala123123@ >Error code: 0 +>19:32:26 AutoIt3.exe ended.rc:0 +>19:32:26 AutoIt3Wrapper Finished. >Exit code: 0 Time: 3.397 Link to comment Share on other sites More sharing options...
Nine Posted 2 hours ago Share Posted 2 hours ago Maybe the problem comes from the LOGIN function ? Since you did not provide it, hard to say. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy 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