[10] RFR 8186654 : Poor quality of sun.security.util.Cache.EqualByteArray.hashCode()
Seán Coffey
sean.coffey at oracle.com
Thu Sep 7 17:25:50 UTC 2017
Looks good to me 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/
>
More information about the security-dev
mailing list