FMS Posted September 2, 2016 Posted September 2, 2016 Hello, I think this is a simple question if you know the answer. At this function i try to (encrypt -> decrypt -> change -> encrypt ->decrypt->check ) an array. This is a snippet from a larger script but the error is the same. I do this encrypt decrypt action so i can save some setting along the way in a file. But at the end (when i change the data and not when i dont change the data) is empty. does somebody see what i'm doing wrong here? expandcollapse popupFunc test() Local $LC_timestamp = @MDAY & "." & @MON & "." & @YEAR & "_" & @HOUR & ":" & @MIN & ":" & @SEC Global $GL_USS_base_count = 4 Global $GL_USS_base[$GL_USS_base_count][2] = [["nickname", "FMS"], ["last_login", $LC_timestamp], ["login_count", "1" ], ["naam3", $LC_timestamp]] Global $encrypted_GL_USS_true[$GL_USS_base_count] Global $encrypted_GL_USS_content_true[$GL_USS_base_count] Global $GL_array_decrypted_USS_names[$GL_USS_base_count] Global $GL_array_decrypted_USS_settings[$GL_USS_base_count] MsgBox($MB_SYSTEMMODAL, "should be 1", $GL_USS_base[2][1]) ;make for $i = 0 to $GL_USS_base_count -1 $encrypted_GL_USS_true[$i] = _Crypt_EncryptData($GL_USS_base[$i][0], $GL_encr_key_settings, $CALG_AES_128) $encrypted_GL_USS_content_true[$i] = _Crypt_EncryptData($GL_USS_base[$i][1], $GL_encr_key_settings, $CALG_AES_128) Next ;get for $i = 0 to $GL_USS_base_count -1 $GL_array_decrypted_USS_names[$i] = binarytostring(_Crypt_DecryptData(binary($encrypted_GL_USS_true[$i]), $GL_encr_key_settings, $CALG_AES_128)) $GL_array_decrypted_USS_settings[$i] = binarytostring(_Crypt_DecryptData(binary($encrypted_GL_USS_content_true[$i]), $GL_encr_key_settings, $CALG_AES_128)) Next MsgBox($MB_SYSTEMMODAL, "should be 1", $GL_array_decrypted_USS_settings[2]) ;change $GL_array_decrypted_USS_settings[2] = $GL_array_decrypted_USS_settings[2] + "1" MsgBox($MB_SYSTEMMODAL, "should be 2", $GL_array_decrypted_USS_settings[2]) ;save for $i = 0 to $GL_USS_base_count -1 $encrypted_GL_USS_true[$i] = _Crypt_EncryptData($GL_array_decrypted_USS_names[$i], $GL_encr_key_settings, $CALG_AES_128) $encrypted_GL_USS_content_true[$i] = _Crypt_EncryptData($GL_array_decrypted_USS_settings[$i], $GL_encr_key_settings, $CALG_AES_128) Next ;get for $i = 0 to $GL_USS_base_count -1 $GL_array_decrypted_USS_names[$i] = binarytostring(_Crypt_DecryptData(binary($encrypted_GL_USS_true[$i]), $GL_encr_key_settings, $CALG_AES_128)) $GL_array_decrypted_USS_settings[$i] = binarytostring(_Crypt_DecryptData(binary($encrypted_GL_USS_content_true[$i]), $GL_encr_key_settings, $CALG_AES_128)) Next ;check MsgBox($MB_SYSTEMMODAL, "should be 2", $GL_array_decrypted_USS_settings[2]) ;why is this emty????? EndFunc thanks in advanced as finishing touch god created the dutch
AdamUL Posted September 2, 2016 Posted September 2, 2016 Why are you converting the binary string returned by _Crypt_EncryptData to binary value when you try to decrypt it. It is already a binary string, there is not need to use the Binary function. This BinaryToString(_Crypt_DecryptData(Binary($encrypted_GL_USS_true[$i]), $GL_encr_key_settings, $CALG_AES_128)) should be BinaryToString(_Crypt_DecryptData($encrypted_GL_USS_true[$i], $GL_encr_key_settings, $CALG_AES_128)) Adam
FMS Posted September 2, 2016 Author Posted September 2, 2016 (edited) Ke thans for the input @AdamUL, i idd tried it and it's still nothing at the and. Edited September 2, 2016 by FMS as finishing touch god created the dutch
genius257 Posted September 3, 2016 Posted September 3, 2016 Now I've looked it over and it seems when you add +1 to the decrypted data, you convert to int instead of string and convert the binary return for a int with the value of 2, to a string. So basically change: $GL_array_decrypted_USS_settings[2] = $GL_array_decrypted_USS_settings[2] + "1" To: $GL_array_decrypted_USS_settings[2] = String( $GL_array_decrypted_USS_settings[2] + "1" ) To show your appreciation My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser
FMS Posted September 3, 2016 Author Posted September 3, 2016 Yes , that totaly was it thanks as finishing touch god created the dutch
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