Advertisement
Prasanga

Untitled

Feb 25th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. string XOR_Encryption(string toBeEncrypted, string sKey)
  2. {
  3. string sEncrypted(toBeEncrypted);
  4. unsigned int iKey=sKey.length();
  5. int iIn=toBeEncrypted.length();
  6. int x=0;
  7. for(int i = 0; i < iIn; i++)
  8. {
  9. sEncrypted[i] = toBeEncrypted[i] ^ sKey[x];
  10. if(++x == iKey){ x = 0; }
  11. }
  12. return sEncrypted;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement