java.lang.Object
net.i2p.util.RandomSource.SecureRandomInit
All Implemented Interfaces:
Runnable
Enclosing class:
RandomSource

private static class RandomSource.SecureRandomInitextends Object implements Runnable
Thread to prevent hanging on init, presumably due to /dev/random blocking, which is common in VMs.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final byte[]
    Bytes read to seed the random.
    private static final int
    How many bytes to read for the seed.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SecureRandomInit(byte[] buf)
    Wraps the buffer that the background secure random seed is written into.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    void
    run()
    Fill the buffer from the system secure random source.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • buf

      private final byte[] buf
      Bytes read to seed the random.
    • SZ

      private static final int SZ
      How many bytes to read for the seed.
      See Also:
  • Constructor Details

    • SecureRandomInit

      public SecureRandomInit(byte[] buf)
      Wraps the buffer that the background secure random seed is written into.
      Parameters:
      buf - the buffer to fill with secure random bytes
  • Method Details

    • run

      public void run()
      Fill the buffer from the system secure random source.
      Specified by:
      run in interface Runnable