Text Encryption for text editor on the save button
-
I am new to all this and have made a text editor ( one of the most easy things to start with ) but i want it to save an encrypted file that no other text editor could read, so when you click save it asks for a password the saves the encrypted text then when someone tries to load it they have to enter the password?? Thanks in advance Steven Richardson! P.S. i have Borland C++ Builder 5
-
I am new to all this and have made a text editor ( one of the most easy things to start with ) but i want it to save an encrypted file that no other text editor could read, so when you click save it asks for a password the saves the encrypted text then when someone tries to load it they have to enter the password?? Thanks in advance Steven Richardson! P.S. i have Borland C++ Builder 5
How long is a piece of string? A really easy way to do it is just to take the raw text and XOR each byte with a constant byte value. That turns the text into garbage. Then you check the password. If it matches you XOR each byte of the garbage with the same constant byte and voila your original text is back. Example: Encryption - 101 xor 011 = 110 Decryption - 110 xor 011 = 101 This is really insecure but it's dead easy. It depends on what level of security you need. If you're just looking for something to stop casual observers then this will do the trick but if you expect someone to expend some effort in cracking your encrypted text and it's security is important then you need to look for something more significant than this. There are plenty of industrial strength algorithms about but I'm no expert on current practices. Just google for 'encryption' for details. The other potential problem with what you propose is that your security model is trivially broken if the password is revealed. Look for 'public key encryption' to avoid this. HTH i1.2sqrt(u).bcos(ur)sec(c) but b4.isqrt(u).ru/16 Navier