894f5d2d1ddc27173a6fc1fa8fe1ae041f9304d8
1 package code
.kalter
.longflight
.crypto
;
3 import java
.io
.IOException
;
4 import java
.io
.InputStream
;
7 * Шифровальный входной поток (обёртка для InputStream). Дешифровка:
12 public class CIStream
extends InputStream
{
14 private final InputStream istream
;
15 private final Random random
;
17 // key - ключ для ГПСЧ
18 public CIStream(InputStream istream
, int key
) {
19 this.istream
= istream
;
20 this.random
= new Random(key
);
23 public int read() throws IOException
{
24 int b
= istream
.read();
25 b ^
= random
.random(0xFF);
26 b
= (b
<< 4) | (b
>> 4);
30 public int available() throws IOException
{
31 return istream
.available();
34 public void close() throws IOException
{