title: Bit manipulation on character string
body: <p>Can we apply bit manipulation on a character string?
  If so, is it always possible to retrieve back a character string from the manipulated string?</p>
  
  <p>I was hoping to use the XOR operator on two strings by converting them to binary and then back to <em>character string</em>.</p>
  
  <p>I took up some code from another StackOverflow question but it only solves half the problem</p>
  
  <pre><code>std::string TextToBinaryString(string words) 
  {
  string binaryString = "";
  for (char&amp; _char : words) 
      {
          binaryString +=std::bitset&lt;8&gt;(_char).to_string();
      }
  return binaryString;
  }
  </code></pre>
  
  <p>I don't know how to convert this string of ones and zeroes back to a string of characters.
  I did read <em>std::stio</em> in some google search results as a solution but was not able to understand them.</p>
  
  <p>The manipulation that I wish to do is </p>
  
  <pre><code>std::string message("Hello World");
  int n = message.size();
  bin_string = TextToBinaryString(message)
  
  std::string left,right;
  bin_string.copy(left,n/2,0);
  bin_string.copy(right,n,n/2);
  
  std::string result = left^right;
  </code></pre>
  
  <p>I know I can hardcode this by picking up every entry and applying the operation but it is the conversion of the binary string back to characters that are making me scratch my head.</p>
  
  <blockquote>
    <p>*EDIT: *I am trying to implement a cipher framework called Feistel cipher (<em>SORRY, should had made that clear before</em>) there they use the property of XOR that when you XOR something with the same thing again it cancels out... For eg. (A^B)^B=A. I wanted to output the ciphered jibberish in the middle. Hence, the query. </p>
  </blockquote>