On Wed, 12 Jun 2024 14:08:43 GMT, Ferenc Rakoczi <d...@openjdk.org> wrote:

>> This PR removes some unnecessary conversions between byte arrays and long 
>> arrays during SHA3 digest computations.
>
> Ferenc Rakoczi has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Fix clone(), accept review suggestions.

src/java.base/share/classes/sun/security/provider/SHA3.java line 73:

> 71:     // The following array is allocated to size WIDTH bytes, but we only
> 72:     // ever use the first blockSize bytes it (for bytes <-> long 
> conversions)
> 73:     private byte[] byteState = new byte[WIDTH];

Since we are storing the state in longs now, this "byte <-> long" conversion 
can be made through a local variable, right? Is there a reason for having this 
`byteState` field with size WIDTH bytes?

src/java.base/share/classes/sun/security/provider/SHA3.java line 121:

> 119:         }
> 120:         implCompress(buffer, 0);
> 121:         int availableBytes = buffer.length;

change to `blockSize` as in `implCompress0(...)`?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19632#discussion_r1638832540
PR Review Comment: https://git.openjdk.org/jdk/pull/19632#discussion_r1637350489

Reply via email to