PBKDF2SHA512: set hLen to correct value of 64

This is a bugfix to the API, but since `MnemonicCode` always
passes `dkLen` of 64 and the `System.arraycopy()` on line 66 truncates
`baos.toByteArray()` to `dkLen` length, the call to `derive()` works
correctly for our use-case.
This commit is contained in:
Sean Gilligan 2023-09-12 10:45:27 -07:00 committed by Andreas Schildbach
parent 4b987cb172
commit c830107bce

View file

@ -41,7 +41,7 @@ public class PBKDF2SHA512 {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
try { try {
int hLen = 20; int hLen = 64; // Length of HMAC result
if (dkLen > ((Math.pow(2, 32)) - 1) * hLen) { if (dkLen > ((Math.pow(2, 32)) - 1) * hLen) {
throw new IllegalArgumentException("derived key too long"); throw new IllegalArgumentException("derived key too long");