[10] RFR 8186654 : Poor quality of sun.security.util.Cache.EqualByteArray.hashCode()
Ivan Gerasimov
ivan.gerasimov at oracle.com
Wed Aug 23 20:54:39 UTC 2017
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