summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-27 08:59:46 (EDT)
committerEike Stepper2007-08-27 08:59:46 (EDT)
commit46f4b235694a37cf1cd636730a65ad00d1fc56a0 (patch)
tree6e67d976eed8125d2a71a1ef13979b136f57954f
parentc63b357a50bc6afcbd5bb6cdfff5a5aed4e1b577 (diff)
downloadcdo-46f4b235694a37cf1cd636730a65ad00d1fc56a0.zip
cdo-46f4b235694a37cf1cd636730a65ad00d1fc56a0.tar.gz
cdo-46f4b235694a37cf1cd636730a65ad00d1fc56a0.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XORInputStream.java8
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XOROutputStream.java8
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XORStreamWrapper.java6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/XORStreamWrapperInjector.java24
4 files changed, 35 insertions, 11 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XORInputStream.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XORInputStream.java
index b2033b3..26a3559 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XORInputStream.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XORInputStream.java
@@ -19,17 +19,17 @@ import java.io.InputStream;
*/
public class XORInputStream extends FilterInputStream
{
- private byte[] key;
+ private int[] key;
private int index;
- public XORInputStream(InputStream in, byte... key)
+ public XORInputStream(InputStream in, int... key)
{
super(in);
this.key = key;
}
- public byte[] getKey()
+ public int[] getKey()
{
return key;
}
@@ -47,7 +47,7 @@ public class XORInputStream extends FilterInputStream
index = 0;
}
- b = b & 0x0f ^ key[index++];
+ b = b & 0xff ^ key[index++] & 0xff;
}
}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XOROutputStream.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XOROutputStream.java
index 291ba70..ca3c8b1 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XOROutputStream.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XOROutputStream.java
@@ -19,17 +19,17 @@ import java.io.OutputStream;
*/
public class XOROutputStream extends FilterOutputStream
{
- private byte[] key;
+ private int[] key;
private int index;
- public XOROutputStream(OutputStream out, byte... key)
+ public XOROutputStream(OutputStream out, int... key)
{
super(out);
this.key = key;
}
- public byte[] getKey()
+ public int[] getKey()
{
return key;
}
@@ -44,7 +44,7 @@ public class XOROutputStream extends FilterOutputStream
index = 0;
}
- b = b & 0x0f ^ key[index++];
+ b = b & 0xff ^ key[index++] & 0xff;
}
super.write(b);
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XORStreamWrapper.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XORStreamWrapper.java
index 65853cb..c7454d4 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XORStreamWrapper.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XORStreamWrapper.java
@@ -19,14 +19,14 @@ import java.io.OutputStream;
*/
public class XORStreamWrapper implements IStreamWrapper<XORInputStream, XOROutputStream>
{
- private byte[] key;
+ private int[] key;
- public XORStreamWrapper(byte[] key)
+ public XORStreamWrapper(int[] key)
{
this.key = key;
}
- public byte[] getKey()
+ public int[] getKey()
{
return key;
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/XORStreamWrapperInjector.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/XORStreamWrapperInjector.java
new file mode 100644
index 0000000..49a24ba
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/XORStreamWrapperInjector.java
@@ -0,0 +1,24 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.signal;
+
+import org.eclipse.net4j.util.io.XORStreamWrapper;
+
+/**
+ * @author Eike Stepper
+ */
+public class XORStreamWrapperInjector extends StreamWrapperInjector
+{
+ public XORStreamWrapperInjector(String protocolID, int[] key)
+ {
+ super(protocolID, new XORStreamWrapper(key));
+ }
+}