mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-29 04:28:30 +00:00
8263978: Clarify why 0 argument is ignored in SecureRandom::setSeed
Reviewed-by: valeriep
This commit is contained in:
parent
15bcf6d9f5
commit
0b2aa1b605
@ -730,10 +730,11 @@ public class SecureRandom extends java.util.Random {
|
||||
@Override
|
||||
public void setSeed(long seed) {
|
||||
/*
|
||||
* Ignore call from super constructor (as well as any other calls
|
||||
* unfortunate enough to be passing 0). It's critical that we
|
||||
* ignore call from superclass constructor, as digest has not
|
||||
* yet been initialized at that point.
|
||||
* Ignore call from super constructor as well as any other calls
|
||||
* unfortunate enough to be passing 0. All SecureRandom
|
||||
* constructors call `super(0)` which leads to `setSeed(0)`.
|
||||
* We either keep the object unseeded (in `new SecureRandom()`)
|
||||
* or we seed the object explicitly (in `new SecureRandom(byte[])`).
|
||||
*/
|
||||
if (seed != 0) {
|
||||
setSeed(longToByteArray(seed));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user