Package org.jastacry.layer
Class RandomLayer
- java.lang.Object
-
- org.jastacry.layer.AbstractBasicLayer
-
- org.jastacry.layer.RandomLayer
-
- All Implemented Interfaces:
java.lang.Runnable
,Layer
public class RandomLayer extends AbstractBasicLayer
Mask every byte with some random data. The random stream is initialized by the init seed. Must be used the same on both sides (encryption and decryption).SPDX-License-Identifier: MIT
- Author:
- Kai Kretschmann
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
LAYERNAME
static name of the layer.-
Fields inherited from class org.jastacry.layer.AbstractBasicLayer
endController, inputStream, logger, outputStream
-
-
Constructor Summary
Constructors Constructor Description RandomLayer()
Constructor of RandomLayer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
encodeAndDecode(java.io.InputStream inputStream, java.io.OutputStream outputStream)
Local encode Stream function which does the real thing for Random Layer.boolean
equals(java.lang.Object o)
Override equals method from object class.long
getSeed()
Getter method.int
hashCode()
Override equals method from object class.void
init(java.lang.String data)
Init function.void
setSeed(long newSeed)
Setter method.-
Methods inherited from class org.jastacry.layer.AbstractBasicLayer
rangeCheck, run, setAction, setEndController, setInputStream, setOutputStream, setRealLayerName, toString
-
-
-
-
Field Detail
-
LAYERNAME
public static final java.lang.String LAYERNAME
static name of the layer.- See Also:
- Constant Field Values
-
-
Method Detail
-
getSeed
public final long getSeed()
Getter method.- Returns:
- long seed value
-
setSeed
public final void setSeed(long newSeed)
Setter method.- Parameters:
newSeed
- long value
-
init
public final void init(java.lang.String data)
Init function.- Parameters:
data
- to initialise the random seed value.
-
encodeAndDecode
public void encodeAndDecode(java.io.InputStream inputStream, java.io.OutputStream outputStream) throws JastacryException
Local encode Stream function which does the real thing for Random Layer.- Parameters:
inputStream
- incoming dataoutputStream
- outgoing data- Throws:
JastacryException
- thrown on error
-
equals
public boolean equals(java.lang.Object o)
Override equals method from object class.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- object to compare with- Returns:
- true or false
-
hashCode
public int hashCode()
Override equals method from object class.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hash of properties
-
-