Integrated: 8357915: SecureRandom nextLong memory usage

Koushik Muthukrishnan Thirupattur duke at openjdk.org
Tue Jul 8 18:27:45 UTC 2025


On Thu, 26 Jun 2025 18:00:21 GMT, Koushik Muthukrishnan Thirupattur <duke at openjdk.org> wrote:

> SecureRandom uses straightforward implementations inherited from Random but in the process does double the memory allocations necessary.
> The delegation to SecureRandom.engineNextBytes does not provide `int` or `long` values, the caller must allocate a byte array and assemble the value itself.
> So added an implementation in SecureRandom that call nextBytes(8 bytes) and then convert that to a long.

This pull request has now been integrated.

Changeset: 91df7978
Author:    Koushik Thirupattur <koushik.thirupattur at oracle.com>
Committer: Bradford Wetmore <wetmore at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/91df7978799e5a24a73d8e1ae344e532e572f2dd
Stats:     11 lines in 1 file changed: 11 ins; 0 del; 0 mod

8357915: SecureRandom nextLong memory usage

Reviewed-by: wetmore

-------------

PR: https://git.openjdk.org/jdk/pull/26005


More information about the security-dev mailing list