public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "csm at gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug classpath/24481] SecureRandom.setSeed has no impact
Date: Tue, 11 Apr 2006 04:21:00 -0000	[thread overview]
Message-ID: <20060411042113.30179.qmail@sourceware.org> (raw)
In-Reply-To: <bug-24481-11561@http.gcc.gnu.org/bugzilla/>



------- 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


  parent reply	other threads:[~2006-04-11  4:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-22  0:52 [Bug java/24481] New: " jrandom-gcc at i2p dot net
2005-10-22  2:28 ` [Bug classpath/24481] " pinskia at gcc dot gnu dot org
2005-10-22  2:36 ` pinskia at gcc dot gnu dot org
2005-10-24 18:47 ` tromey at gcc dot gnu dot org
2006-04-07 11:07 ` david at jpackage dot org
2006-04-11  4:21 ` csm at gnu dot org [this message]
2006-04-11  4:34 ` david at jpackage dot org
2006-04-11 20:58 ` csm at gnu dot org
2006-04-12  0:11 ` david at jpackage dot org
2006-04-12  4:46 ` csm at gnu dot org
2006-04-12 16:39 ` cvs-commit at developer dot classpath dot org
2006-04-12 18:19 ` csm at gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060411042113.30179.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).