Package eu.kartoffelquadrat.visucrypt
Class OneTimePadGenerator
- java.lang.Object
-
- eu.kartoffelquadrat.visucrypt.OneTimePadGenerator
-
public class OneTimePadGenerator extends Object
Creates random 2D boolean arrays which can be used as one time pads.
-
-
Constructor Summary
Constructors Constructor Description OneTimePadGenerator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
booleanFromByte(byte b)
Strips a random byte value to a single bit value by extracting only the first position.static boolean[][]
generatePad(int width, int height)
Creates random 2D boolean arrays of desired dimension.
-
-
-
Method Detail
-
generatePad
public static boolean[][] generatePad(int width, int height)
Creates random 2D boolean arrays of desired dimension. Every position is extracted from an individual random byte by stripping it to the first bit position.- Parameters:
width
- as desired x dimensions of produced 2D arrayheight
- as desired y dimensions of produced 2D array- Returns:
- n2D boolean array of desired dimensions with random values
-
booleanFromByte
public static boolean booleanFromByte(byte b)
Strips a random byte value to a single bit value by extracting only the first position.- Parameters:
b
- as a random input byte.- Returns:
- a single bit value, which is the first bit of the provided input byte.
-
-