mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-18 13:22:42 +01:00
PBKDF2SHA512: simplify F()
by using ByteUtils.concat()
This commit is contained in:
parent
053cd60dc5
commit
3023188541
@ -23,6 +23,7 @@
|
||||
|
||||
package org.bitcoinj.crypto;
|
||||
|
||||
import org.bitcoinj.base.internal.ByteUtils;
|
||||
import org.bitcoinj.base.internal.Preconditions;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
@ -88,12 +89,7 @@ public class PBKDF2SHA512 {
|
||||
|
||||
for (int j = 0; j < c; j++) {
|
||||
if (j == 0) {
|
||||
byte[] baS = S.getBytes(StandardCharsets.UTF_8);
|
||||
byte[] baI = INT(i);
|
||||
byte[] baU = new byte[baS.length + baI.length];
|
||||
|
||||
System.arraycopy(baS, 0, baU, 0, baS.length);
|
||||
System.arraycopy(baI, 0, baU, baS.length, baI.length);
|
||||
byte[] baU = ByteUtils.concat(S.getBytes(StandardCharsets.UTF_8), INT(i));
|
||||
|
||||
U_XOR = mac.doFinal(baU);
|
||||
U_LAST = U_XOR;
|
||||
|
Loading…
Reference in New Issue
Block a user