Compare commits
2 Commits
c047b04d95
...
a1cf5f4202
| Author | SHA1 | Date | |
|---|---|---|---|
|
a1cf5f4202
|
|||
|
6020269957
|
@@ -1,5 +1,5 @@
|
||||
group = "com.infendro"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
|
||||
repositories {
|
||||
maven("https://git.infendro.com/api/packages/Infendro/maven")
|
||||
@@ -22,6 +22,7 @@ kotlin {
|
||||
commonMain.dependencies {
|
||||
implementation(libs.mac)
|
||||
implementation(libs.hash)
|
||||
implementation(libs.bytearray)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[versions]
|
||||
kotlin = "2.1.20"
|
||||
mac = "1.1.0"
|
||||
hash = "1.2.0"
|
||||
mac = "1.1.2"
|
||||
hash = "1.2.2"
|
||||
bytearray = "1.1.1"
|
||||
|
||||
[plugins]
|
||||
multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
||||
@@ -9,3 +10,4 @@ multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotl
|
||||
[libraries]
|
||||
mac = { module = "com.infendro:mac", version.ref = "mac" }
|
||||
hash = { module = "com.infendro:hash", version.ref = "hash" }
|
||||
bytearray = { module = "com.infendro:bytearray", version.ref = "bytearray" }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
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.kdf.util.addAll
|
||||
import com.infendro.kdf.util.toByteArray
|
||||
import com.infendro.kdf.util.xor
|
||||
import com.infendro.mac.HMAC
|
||||
|
||||
class PBKDF2(
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user