Class ChaCha20Random

java.lang.Object
java.util.Random
java.security.SecureRandom
jadex.ipc.impl.security.random.ChaCha20Random
All Implemented Interfaces:
Serializable, RandomGenerator

public class ChaCha20Random extends SecureRandom
See Also:
  • Field Details

    • entropysource

      protected IEntropySource entropysource
      Entropy source for seeding, use SSecurity.
    • basestate

      protected int[] basestate
      ChaCha base state
    • blockcount

      protected long blockcount
      Current block count.
    • outputblock

      protected byte[] outputblock
      The output block.
    • outptr

      protected int outptr
      Pointer to unused output.
  • Constructor Details

    • ChaCha20Random

      public ChaCha20Random()
      Initializes the PRNG.
    • ChaCha20Random

      public ChaCha20Random(IEntropySource seedrandom)
      Initializes the PRNG.
    • ChaCha20Random

      public ChaCha20Random(byte[] initialseed)
      Initializes the PRNG.
    • ChaCha20Random

      public ChaCha20Random(IEntropySource entropysource, byte[] initialseed)
      Initializes the PRNG.
  • Method Details

    • nextLong

      public long nextLong()
      Gets the next long.
      Specified by:
      nextLong in interface RandomGenerator
      Overrides:
      nextLong in class Random
    • nextInt

      public int nextInt()
      Gets the next int.
      Specified by:
      nextInt in interface RandomGenerator
      Overrides:
      nextInt in class Random
    • nextBytes

      public void nextBytes(byte[] bytes)
      Gets the next bytes.
      Specified by:
      nextBytes in interface RandomGenerator
      Overrides:
      nextBytes in class SecureRandom
    • nextBlock

      protected void nextBlock()
      Generates the next ChaCha block.
    • reseed

      public void reseed()
      Reseeds the PRNG.
      Overrides:
      reseed in class SecureRandom
    • reseed

      public void reseed(byte[] providedseed)
      Reseeds the PRNG.
    • nextBlock

      public void nextBlock(byte[] outputblock)
      Generate next block (64 bytes).
      Parameters:
      outputblock - The block.
    • generateSeed

      public byte[] generateSeed(int numbytes)
      Generates a seed value from OS source.
      Overrides:
      generateSeed in class SecureRandom