C # simplest text encryption,
Private char [] TextEncrypt (string content, string secretKey) {char [] data = content. toCharArray (); char [] key = secretKey. toCharArray (); for (int I = 0; I <data. length; I ++) {data [I] ^ = key [I % key. length];} return data;} private string TextDecrypt (char [] data, string secretKey) {char [] key = secretKey. toCharArray (); for (int I = 0; I <data. length; I ++) {data [I] ^ = key [I % key. length];} return new string (data );}
The above is the simplest function for encrypting and decrypting text. It does not require the support of any database file, but only distinguishes the original text from the key in bytes. It is very easy to translate the ciphertext Back, take the password and the key to try again or try again.
If the key is correct, the correct original text will be returned. If the key is incorrect, the translation will be a bunch of garbled characters.
Therefore, it also provides the simplest encryption function.