[10] RFR 8186654 : Poor quality of sun.security.util.Cache.EqualByteArray.hashCode()

Ivan Gerasimov ivan.gerasimov at oracle.com
Thu Sep 7 17:28:37 UTC 2017


On 9/7/17 10:25 AM, Seán Coffey wrote:
> Looks good to me Ivan.
>
Thanks Seán!

With kind regards,
Ivan


> regards,
> Sean.
>
> On 23/08/2017 21:54, Ivan Gerasimov wrote:
>> Hello!
>>
>> An auxiliary class EqualByteArray implements hashCode() in a way that 
>> small changes to the content do not change the hash value.
>>
>> It is proposed to reuse Arrays.hashCode(byte[]) for the hash code 
>> calculations.
>>
>> Also, the private int hash is made non-volatile, as it removes 
>> accessing to a volatile variable in the relatively frequently 
>> executed code for the price of relatively less likely chance of a 
>> double hash code calculation.  (For reference, java.lang.String uses 
>> the same approach.)
>>
>> Would you please help review the fix?
>>
>> BUGURL: https://bugs.openjdk.java.net/browse/JDK-8186654
>> WEBREV: http://cr.openjdk.java.net/~igerasim/8186654/00/webrev/
>>
>
>

-- 
With kind regards,
Ivan Gerasimov




More information about the security-dev mailing list