visnja Posted July 14, 2013 Share Posted July 14, 2013 okay , so i accidently decrypted 1 file , and saved over my encrypted file,i dont have backup , but i know password , and algorithm it used , but when i try to encrypt , i get encrypted data thats not the same as before , what am i doing wrong? Link to comment Share on other sites More sharing options...
trancexx Posted July 14, 2013 Share Posted July 14, 2013 what am i doing wrong?Not giving enough information. What algo it was?Nice nick name. Is that a fruit too? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
visnja Posted July 14, 2013 Author Share Posted July 14, 2013 (edited) alg was $calg_aes_256 and when i crypt it with the password i used before i get different result,(i check it with my script that used to read it and convert to string,but the result is not the same , i dont get it..) and yeah visnja is a fruit^^ -update- Basicaly when i crypt and decrypt anything with same pw , i get different result ... help plz Edited July 14, 2013 by visnja Link to comment Share on other sites More sharing options...
trancexx Posted July 14, 2013 Share Posted July 14, 2013 But darling sweet bitter visnja you should post the code if you want help. If your code is correct then there is no reason not to get the correct result. If you get wrong result then very likely your code is not right. Maybe the input for decription is somehow wrong.It's impossible to tell without you showing what you did. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
visnja Posted July 14, 2013 Author Share Posted July 14, 2013 (edited) ok i crypt it with this #include <crypt.au3> Local $file = FileOpen(@ScriptDir & "\blabla.lic") Local $password = ("blabla") Local $encrypted = FileRead($file) Local $cryptedbinary = _Crypt_EncryptData($encrypted, $password, $calg_aes_256) Local $crypted = BinaryToString($cryptedbinary) MsgBox(0,"",$crypted) ClipPut($crypted) then i paste the data i got into blabla.lic and decrypt with this #include <crypt.au3> Local $file = FileOpen(@ScriptDir & "\blabla.lic") Local $password = ("blabla") Local $encrypted = FileRead($file) Local $decryptedbinary = _crypt_decryptdata($encrypted, $password, $calg_aes_256) Local $decrypted = BinaryToString($decryptedbinary) MsgBox(0,"",$decrypted) and i get weird result on decryption, and is it possible to crypt with 1 algo and decrypt with other? Edited July 14, 2013 by visnja Link to comment Share on other sites More sharing options...
czardas Posted July 14, 2013 Share Posted July 14, 2013 (edited) If you overwrote a file then I don't know how you can get it back. I would avoid using the same file for plaintext as you use for encryption unless you are really sure everything works as expected. I would also use FileWrite instead of using ClipPut followed by pasting into a document. Edited July 14, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
visnja Posted July 14, 2013 Author Share Posted July 14, 2013 this was just blabla file , demonstration of what i did , its different in my code but yet the same pattern Link to comment Share on other sites More sharing options...
trancexx Posted July 14, 2013 Share Posted July 14, 2013 I just made blabla file, wrote Test String to it and run both of your snippets like you explained. And guess what? You are right. At the end I didn't get out what what I put in. ...That's because you did BinaryToString() and then ClipPut(). BinaryToString will convert binary data to string representation, but the problem with your idea is that string is taken to be null-terminated for ClipPut(). That means that when 0x00 binary is found, string will end. In case of encryption algo and the key you used and string I used 0x00 will be at the beginning. So the string will end before it even started. Long story short - rethink your Clipboard thing strategy and do what czardas told you. visnja duso. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Solution visnja Posted July 15, 2013 Author Solution Share Posted July 15, 2013 Ok , this happened , i restarted pc , and guess what it worked ,lol 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