On Fri, 28 Apr 2023 00:47:39 GMT, Weijun Wang <wei...@openjdk.org> wrote:

> My feeling is that modern APIs use `from` and `to` instead of `from` and 
> `length`. For example, `Arrays.copyOfRange`, `Arrays.equals` and 
> `Arrays.compare` vs `new String(daata, from, length)`.

I don't see this as a modern vs old API style, it's consistency.  
`Arrays.copyOfRange()` is from 1.6.  I think it's being consistent with other 
JCA classes, like Cipher, Signature, MessageDigest, and Mac.  I'm not aware of 
any JCA that uses (from, to).

Also `Arrays` methods use length of any size.  KEM does not.  In fact it is 
very obvious what the length is as it must be the key size when looking at 
`DHKEM.decapsulate(...)`:

    Objects.checkFromToIndex(from, to, params.Nsecret);

One could argue that `to` isn't necessary given the length is fixed by the 
`params`.

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

PR Comment: https://git.openjdk.org/jdk/pull/13256#issuecomment-1527859403

Reply via email to