1 package code
.kalter
.longflight
.crypto
;
3 import java
.io
.IOException
;
4 import java
.io
.InputStream
;
7 * Шифровальный входной поток
11 public class CIStream
extends InputStream
{
13 private final InputStream istream
;
14 private final Random random
;
16 public CIStream(InputStream istream
, int key
) {
17 this.istream
= istream
;
18 this.random
= new Random(key
);
22 public int read() throws IOException
{
23 int b
= istream
.read();
24 b
= (b
<< 4) | (b
>> 4);
25 b ^
= random
.random(0xFF);
30 public int available() throws IOException
{
31 return istream
.available();
35 public void close() throws IOException
{