This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
[Bug classpath/24481] SecureRandom.setSeed has no impact
- From: "csm at gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: java-prs at gcc dot gnu dot org
- Date: 11 Apr 2006 04:21:13 -0000
- Subject: [Bug classpath/24481] SecureRandom.setSeed has no impact
- References: <bug-24481-11561@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from csm at gnu dot org 2006-04-11 04:21 -------
The original issue seems to be fixed; on gcj version `gcj (GCC) 4.2.0 20060410
(experimental)' I get this output from the `seed' testcase:
> Byte difference in a seeded PRNG: 64
> Seed data: 9c1185a5c5e9fc5461288977ee8f548b2258d3138bbc57e4cbe8b6a1d2c999ef6253e0a6e58196ae643db8559e6ba7c97214bd66197b97184d68e3b0654b
David, are you saying that if you have a program like:
> import java.security.SecureRandom;
>
> class sr
> {
> public static void main (String[] argv) throws Throwable
> {
> SecureRandom sr = new SecureRandom ();
> byte[] b = new byte[64];
> sr.nextBytes (b);
> for (int i = 0; i < b.length; i++)
> {
> System.out.print (b[i]);
> System.out.print (' ');
> }
> System.out.println ();
> }
> }
...that you get the same output every time?
If so, this is because our default SecureRandom isn't seeded when created.
Ideally, we would try to use `/dev/random,' or some timing data to get a random
seed.
--
csm at gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |david at jpackage dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24481