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

SecureRandom function implementation is too slow.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P2 P2
    • None
    • 1.0
    • security-libs
    • None

      import java.util.Random;
      import java.security.SecureRandom;

      public class GenerateSeed {
      If you Run this code on a Ultra 1, you will see that it takes over 5 seconds.
      This code is used in generating a random in case of JSSE, so it appears that
      this one of the reasons why its is slow.

      Could you consider a native implementation of SecureRandom function with JDK
      so speed up?

          public static void main(String [] args)
          {
              int index;
              SecureRandom s = new SecureRandom();
              long t = System.currentTimeMillis();

              for (index = 0; index < 5; index++) {
                  byte[] seed = s.generateSeed(20);
              }
              System.out.println ("Time per invocation = " + ((System.currentTimeMill
      is() - t)/5) + " milliseconds.");
          }
      }

            jlueheorcl Jan Luehe (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: