Created
May 23, 2012 06:30
-
-
Save md-5/2773546 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.raphfrk.craftproxylitest; | |
import java.io.FilterOutputStream; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import org.bouncycastle.crypto.StreamCipher; | |
public class CiphOut extends FilterOutputStream { | |
private StreamCipher ciph; | |
public CiphOut(OutputStream out, StreamCipher ciph) { | |
super(out); | |
this.ciph = ciph; | |
} | |
@Override | |
public void write(int b) throws IOException { | |
out.write(ciph.returnByte((byte) b)); | |
} | |
@Override | |
public void write(byte[] b, int off, int len) throws IOException { | |
byte[] bytes; | |
bytes = new byte[len]; | |
ciph.processBytes(b, off, len, bytes, 0); | |
out.write(bytes, 0, len); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment