Is this a valid xor encryption function?
Code:#include <iostream> #include <string> using namespace std; void xorEncrypt(string& str, string key) { int strLen = str.length() - 1; for(int x=0; x <= strLen; x++) { str[x] = str[x]^key[x]; } } int main() { string key = "key"; string text="This my text..."; xorEncrypt(text,key); cout<<text<<endl; xorEncrypt(text,key); cout<<text<<endl; }