Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8066397

Remove network-related seed initialization code in ThreadLocal/SplittableRandom

XMLWordPrintable

    • 8
    • b42
    • Not verified

        ThreadLocalRandom (and SplittableRandom) by default computes an initial seed to the PRNG using the mac address obtained via NetworkInterface.getNetworkInterfaces(). This unfortunately can result in high very initialization costs on certain platforms (Windows) which in turn can propagate to other classes such as ConcurrentSkipList*.

        The fallback mode if a mac address cannot be obtained is to compute an initial seed from the current system time, which is no worse than JDK 7.

        The network code should be removed from both classes. This is compliant with the specification which, by default, does not specify the seed strength. Developers that require a cryptographically random seed should set the system property "java.util.secureRandomSeed" to true.

        However, we should revisit this code when there is an enhancement to provide an efficient "system" seed of a certain cryptographic strength that is optimal for the platform and has low initlization costs so it may be used by TLR/SR.

              psandoz Paul Sandoz
              psandoz Paul Sandoz
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: