On Mon, 16 Sep 2024 19:21:13 GMT, Kevin Driver <kdri...@openjdk.org> wrote:

>> Introduce an API for Key Derivation Functions (KDFs), which are 
>> cryptographic algorithms for deriving additional keys from a secret key and 
>> other data. See [JEP 478](https://openjdk.org/jeps/478).
>> 
>> Work was begun in [another PR](https://github.com/openjdk/jdk/pull/18924).
>
> Kevin Driver has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   IDE formatting broke snippet

src/java.base/share/classes/com/sun/crypto/provider/HKDFKeyDerivation.java line 
86:

> 84:         }
> 85:         // added to enforce valid values at reviewer's request
> 86:         if (!Arrays.asList(SUPPORTED_HMAC_SIZES).contains(hmacLen)) {

Since the array of SUPPORTED_HMAC_SIZES is ordered in ascending natural order, 
you don't need to wrap it as a list to check for contains:
Suggestion:

        if (Arrays.binarySearch(SUPPORTED_HMAC_SIZES, hmacLen) < 0) {

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20301#discussion_r1762509134

Reply via email to