title: XOR Crypt with Linux & Windows different
body: <p>currently I'm programming a chat with XOR-Encryption. But today i encountered a problem. The encryption is under Windows different as in Linux. Under Linux the chat runs normally, but under Windows not. </p>
  
  <p>Here the class:</p>
  
  <pre><code>class XOR_c {
      private boolean active = true;
      private int key;
  
      // Constructor
      public XOR_c(int k){
          if (System.getProperty("os.name").contains("Windows")) {
              JOptionPane.showMessageDialog(null,"No encryption!","Client", JOptionPane.CANCEL_OPTION);
              this.active = false;
          }
  
          key = k;
      }
  
      public String encode(String s) {
          if (active == false) return s;
  
          char[] c = s.toCharArray();
          for (int i=0; i&lt;c.length; i++)
              c[i] = (char)(c[i]^key);
  
          return new String(c);
      }
  
      public String decode(String s){
          return encode(s);
      }
  
  
  }
  </code></pre>
  
  <p>This is tested with openSuse, Debian and Windows 7.</p>
  
  <p>Now how to fix it (At this moment I made a bypass for the encryption but this is not my target, I want a encryption with both systems)? Is my source wrong?</p>