mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-07 09:39:15 +00:00
8357915: SecureRandom nextLong memory usage
Reviewed-by: wetmore
This commit is contained in:
parent
92712ef45d
commit
91df797879
@ -25,6 +25,7 @@
|
||||
|
||||
package java.security;
|
||||
|
||||
import jdk.internal.util.ByteArray;
|
||||
import sun.security.jca.GetInstance;
|
||||
import sun.security.jca.GetInstance.Instance;
|
||||
import sun.security.jca.Providers;
|
||||
@ -837,6 +838,16 @@ public class SecureRandom extends java.util.Random {
|
||||
return next >>> (numBytes*8 - numBits);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public long nextLong() {
|
||||
byte[] b = new byte[8];
|
||||
nextBytes(b); // Calls engineNextBytes internally
|
||||
return ByteArray.getLong(b, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the given number of seed bytes, computed using the seed
|
||||
* generation algorithm that this class uses to seed itself. This
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user