This commit is contained in:
@@ -19,8 +19,6 @@ class PBKDF2(
|
||||
private val hmac = HMAC(function)
|
||||
|
||||
override fun hashInto(value: ByteArray, salt: ByteArray, destination: ByteArray, destinationOffset: Int) {
|
||||
val buffer = ByteArray(hmac.bytes)
|
||||
|
||||
for (iteration in 1..bytes.ceilDiv(hmac.bytes)) {
|
||||
val offset = (iteration - 1) * hmac.bytes
|
||||
val block = minOf(bytes - offset, hmac.bytes)
|
||||
@@ -29,7 +27,7 @@ class PBKDF2(
|
||||
salt.copyInto(s)
|
||||
iteration.copyInto(s, salt.size)
|
||||
|
||||
hmac.hashInto(value, s, buffer)
|
||||
val buffer = hmac.hash(value, s)
|
||||
buffer.copyInto(destination, destinationOffset + offset, endIndex = block)
|
||||
repeat(iterations - 1) {
|
||||
hmac.hashInto(value, buffer, buffer)
|
||||
|
||||
Reference in New Issue
Block a user