United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4210047 SecureRandom Initialization VERY slow
JDK-4210047 : SecureRandom Initialization VERY slow

Details
Type:
Bug
Submit Date:
1999-02-09
Status:
Closed
Updated Date:
1999-03-02
Project Name:
JDK
Resolved Date:
1999-03-02
Component:
security-libs
OS:
windows_98
Sub-Component:
java.security
CPU:
x86
Priority:
P4
Resolution:
Won't Fix
Affected Versions:
1.2.0
Fixed Versions:

Related Reports

Sub Tasks

Description

Name: jn10789			Date: 02/09/99


SecureRandom takes an inordinate amount of time to initialize in Windows 98. I am running on a 300 MHz Pentium II with Windows 98, 192 MB RAM, and 8 GB HD space. Nothing else is running at the time the following program runs. I tried with and without optimization.

import java.security.*;
import java.util.*;

public final class RandomTest {
  private SecureRandom random = new SecureRandom();
	
  public RandomTest() {
    Date start = new Date();
    System.out.println("Random int: " + random.nextInt());
    Date end = new Date();
    System.out.println("Start: " + start);
    System.out.println("End: " + end);
  }
	
  public static void main(String[] args) {
    new RandomTest();
  }
}

And the output:

Random int: -1035658255
Start: Sat Feb 06 12:19:10 EST 1999
End: Sat Feb 06 12:19:44 EST 1999

Note that it took 34 seconds to initialize!

I have run SecureRandom (1.1.6) on a Windows NT machine (150 MHz Pentium) and it only took about 5 seconds to start up.

Any ideas?

Thanks, Ralph
(###@###.###)
(Review ID: 53841)
======================================================================

                                    

Comments
EVALUATION


charlie.lai@Eng 1999-03-02

the slowness is due to the Win95/Win98 OS
and the fact that our SecureRandom implementation
needed to be done in pure java.

for better performance (without compromising the quality of
random numbers generated), you can use JDK 1.2's SecureRandom
provider-based implementation to plug in
your own SecureRandom provider (which can be native).
                                     
2004-06-11



Hardware and Software, Engineered to Work Together