Class OneTimePadGenerator


  • public class OneTimePadGenerator
    extends Object
    Creates random 2D boolean arrays which can be used as one time pads.
    • Constructor Detail

      • OneTimePadGenerator

        public OneTimePadGenerator()
    • 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 array
        height - 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.