RFR: 8311170: Simplify and modernize equals and hashCode in security area [v12]
Pavel Rappo
prappo at openjdk.org
Fri Aug 4 20:55:39 UTC 2023
On Fri, 4 Aug 2023 19:45:34 GMT, Sean Mullan <mullan at openjdk.org> wrote:
>> Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Feedback
>
> src/java.base/share/classes/com/sun/crypto/provider/DESKey.java line 113:
>
>> 111: public int hashCode() {
>> 112: int retval = 0;
>> 113: for (int i = 1; i < this.key.length; i++) {
>
> I don't really know why the hashCode impl skipped the first byte of the array. Source code history doesn't give any insight. I thought maybe this had something to do with the parity bits (8 bits of a DES key are used for parity) but those are every 8th bit, and not all in the first byte. Best I can guess is that this is just an oversight and it should have included all bytes in the hash code calculation.
Thanks for checking.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14738#discussion_r1284838423
More information about the security-dev
mailing list