update dependencies

This commit is contained in:
2025-07-24 21:10:03 +02:00
parent c047b04d95
commit 6020269957
4 changed files with 8 additions and 31 deletions

View File

@@ -22,6 +22,7 @@ kotlin {
commonMain.dependencies { commonMain.dependencies {
implementation(libs.mac) implementation(libs.mac)
implementation(libs.hash) implementation(libs.hash)
implementation(libs.bytearray)
} }
} }
} }

View File

@@ -1,7 +1,8 @@
[versions] [versions]
kotlin = "2.1.20" kotlin = "2.1.20"
mac = "1.1.0" mac = "1.1.2"
hash = "1.2.0" hash = "1.2.2"
bytearray = "1.1.1"
[plugins] [plugins]
multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
@@ -9,3 +10,4 @@ multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotl
[libraries] [libraries]
mac = { module = "com.infendro:mac", version.ref = "mac" } mac = { module = "com.infendro:mac", version.ref = "mac" }
hash = { module = "com.infendro:hash", version.ref = "hash" } hash = { module = "com.infendro:hash", version.ref = "hash" }
bytearray = { module = "com.infendro:bytearray", version.ref = "bytearray" }

View File

@@ -1,9 +1,9 @@
package com.infendro.kdf package com.infendro.kdf
import com.infendro.bytearray.addAll
import com.infendro.bytearray.toByteArray
import com.infendro.bytearray.xor
import com.infendro.hash.HashFunction import com.infendro.hash.HashFunction
import com.infendro.kdf.util.addAll
import com.infendro.kdf.util.toByteArray
import com.infendro.kdf.util.xor
import com.infendro.mac.HMAC import com.infendro.mac.HMAC
class PBKDF2( class PBKDF2(

View File

@@ -1,26 +0,0 @@
package com.infendro.kdf.util
import kotlin.experimental.xor
internal infix fun ByteArray.xor(
that: ByteArray,
): ByteArray {
if (this.size != that.size) throw Exception()
return ByteArray(size) { i ->
this[i] xor that[i]
}
}
internal fun MutableCollection<Byte>.addAll(
bytes: ByteArray,
): Boolean {
return addAll(bytes.toList())
}
internal fun UInt.toByteArray(): ByteArray {
return ByteArray(4) { i ->
val offset = (3 - i) * 8
(this shr offset).toByte()
}
}