title: How to decrypt simple XOR encryption
body: <p>I found the following XOR encryption function on the internet:</p>
  
  <pre><code>void xor_encrypt(char *key, char *string)
  {
      int i, string_length = strlen(string);
      for(i=0; i&lt;string_length; i++)
      {
          string[i]=string[i]^key[i];
          printf("%i", string[i]);
      }
  }
  </code></pre>
  
  <p>It works perfect, but I would like to decrypt the string also.</p>
  
  <p>For example:</p>
  
  <pre><code>void xor_decrypt(char *key, char *encrypted_string)
  {
      //decrypt method goes here
  }
  </code></pre>
  
  <p>So basically after I encrypt the string, I would use the same encryption key to decrypt the previously encrypted string. </p>
  
  <p>I'm pretty new to programming and I would just like to know how to decrypt the previously encrypted string. Thanks, all help is appreciated.</p>