title: XOR encrypting of a float-array in c
body: <p>I want to encrypt a float-type array and decode it again with the same function. I have read several threads on the web but i couldn't find a solution that makes me happy. 
  I tried to cast the float-type-pointer to char* and XOR the result with my char-typed key. 
  Here my encode function:</p>
  
  <pre><code>const char* key = "mykey";
  int keylen = sizeof(key) / sizeof(key[0]);
  
  void encodeData(float *data, int size)
  {
      int bytes = (int)(sizeof(float)/sizeof(char));
  
      for(int i=0; i&lt;size; i++)
      {
          for(int j=0; j&lt;bytes; j++)
          {
              data[i] = *(((char *)&amp;data[i]) + j) ^ (key[(bytes*i)%keylen]);
          }
      }
  }
  </code></pre>
  
  <p>Compiling works but i don't get the same results after en- and decoding. What am I doing wrong?</p>