RFR: 8333867: SHA3 performance can be improved
Vladimir Kozlov
kvn at openjdk.org
Tue Jun 11 15:57:13 UTC 2024
On Tue, 11 Jun 2024 08:03:48 GMT, Ferenc Rakoczi <duke at openjdk.org> wrote:
>> Well, the intrinsic function treats the input and state as long arrays anyways, and so it only works on little endian architectures, where the conversion is a no-op. There is no additional array copy, this b2lLittle() call used to be in the keccak() method (along with the conversion back to byte array), the point of this whole change is that only one of these conversions should be done with every keccak() call (an additional benefit is that the xor and the corresponding loads+store is done on longs, not on bytes).
>
> Oh, and about the length: buffer is allocated in the constructor of the parent class (DigestBase) like this:
> buffer = new byte[blockSize];
> Here blockSize is one of { 72, 104, 136, 144, 168 }, so divisible by 8.
> buffer.length was used before probably because blockSize was declared private in DigestBase. I made it protected, because in my opinion it is easier to read the code this way.
Thank you for explanation.
An other question. Is any other use of `longBuf` array after `implCompress0()` call which load values from it? Because Intrinsic code will not update it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19632#discussion_r1635128980
More information about the security-dev
mailing list