title: Implementing XOR in a simple image encryption method
body: <p>So with the help of you guys I finished creating my very simple image encrypter. It's enough to keep any non-tech person out, right? :P</p>
  
  <p>Now to the next step. Someone suggested I use XOR. I read about XOR and it's basically a logical table that determines what the answer is between two bits, right?</p>
  
  <p>Only when one is true, the statement is true.</p>
  
  <p>0 0 = false
  1 0 = true 
  0 1 = true
  1 1 = false</p>
  
  <p>Is this correct? So, how would I go about XOR encrypting an image?</p>
  
  <p>Here's my previous way using a Caeser cipher.</p>
  
  <pre><code>private void EncryptFile()
      {            
          OpenFileDialog dialog = new OpenFileDialog();
          dialog.Filter = "JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif";
          dialog.InitialDirectory = @"C:\";
          dialog.Title = "Please select an image file to encrypt.";
          byte[] ImageBytes;
          if (dialog.ShowDialog() == DialogResult.OK)
          {
              ImageBytes = File.ReadAllBytes(dialog.FileName);
  
              for (int i = 0; i &lt; ImageBytes.Length; i++)
              {
                  ImageBytes[i] = (byte)(ImageBytes[i] + 5);
              }
  
              File.WriteAllBytes(dialog.FileName, ImageBytes);
          }            
      }
  
      private void DecryptFile()
      {
          OpenFileDialog dialog = new OpenFileDialog();
          dialog.Filter = "JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif";
          dialog.InitialDirectory = @"C:\";
          dialog.Title = "Please select an image file to decrypt.";
          byte[] ImageBytes;
          if (dialog.ShowDialog() == DialogResult.OK)
          {
              ImageBytes = File.ReadAllBytes(dialog.FileName);
  
              for (int i = 0; i &lt; ImageBytes.Length; i++)
              {
                  ImageBytes[i] = (byte)(ImageBytes[i] - 5);
              }
  
              File.WriteAllBytes(dialog.FileName, ImageBytes);
          }            
      }
  </code></pre>