mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-11 05:23:55 +08:00
re PR libgcj/9271 (Severe bias in java.security.SecureRandom)
2003-02-13 Casey Marshall <rsdio@metastatic.org> PR libgcj/9271: * java/security/SecureRandom.java (next): Avoid bias in results. From-SVN: r62851
This commit is contained in:
parent
06b5f09133
commit
894c84e4d9
@ -1,3 +1,8 @@
|
||||
2003-02-13 Casey Marshall <rsdio@metastatic.org>
|
||||
|
||||
PR libgcj/9271:
|
||||
* java/security/SecureRandom.java (next): Avoid bias in results.
|
||||
|
||||
2003-02-13 Michael <konqueror@gmx.de>
|
||||
|
||||
* gnu/java/nio/FileChannelImpl.java
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* SecureRandom.java --- Secure Random class implmentation
|
||||
Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
@ -36,6 +36,7 @@ obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
package java.security;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Random;
|
||||
import java.util.Enumeration;
|
||||
@ -358,9 +359,10 @@ public class SecureRandom extends Random
|
||||
int ret = 0;
|
||||
|
||||
for (int i = 0; i < tmp.length; i++)
|
||||
ret |= tmp[i] << (8 * i);
|
||||
ret |= (tmp[i] & 0xFF) << (8 * i);
|
||||
|
||||
return ret;
|
||||
long mask = (1L << numBits) - 1;
|
||||
return (int) (ret & mask);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user