update README

This commit is contained in:
2025-12-13 21:13:17 +01:00
parent 9a9543a1ff
commit 8552d3dd2e

View File

@@ -1,15 +1,18 @@
# Kotlin KDF # kdf-kt
This library provides various [Key Derivation Function](https://en.wikipedia.org/wiki/Key_derivation_function) `kdf-kt` is a Kotlin Multiplatform library that provides common key derivation functions.
implementations in Kotlin Multiplatform.
## Features Supported functions:
- PBKDF2
* [PBKDF2](https://en.wikipedia.org/wiki/PBKDF2) ## Targets
* Multiplatform support
* JVM | Target | Status |
* JavaScript |------------------|---------------|
* Native (Linux) | JVM | Supported |
| JavaScript | Supported |
| Native (Linux) | Supported |
| Native (Windows) | Not Supported |
## Installation ## Installation
@@ -21,24 +24,24 @@ repositories {
} }
dependencies { dependencies {
implementation("com.infendro:kdf:1.0.3") implementation("com.infendro:kdf:1.1.0")
} }
``` ```
## Usage ## Usage
```kotlin ```kotlin
import com.infendro.hash.SHA256 import com.infendro.hash.`SHA-256`
import com.infendro.kdf.PBKDF2 import com.infendro.kdf.PBKDF2
fun main() { fun main() {
// create a PBKDF2 instance using HMAC SHA256 // create a PBKDF2 instance using HMAC SHA256
val kdf = PBKDF2(SHA256) // this example uses 32 bytes of length and 100_000 iterations
val kdf = PBKDF2(32, 100_000, `SHA-256`)
// securely hash value with some salt // securely hash value with some salt
// this example uses 100_000 iterations and 32 bytes of length val value = "password".encodeToByteArray().asUByteArray()
val value = "password".encodeToByteArray() val salt = "salt".encodeToByteArray().asUByteArray()
val salt = "...".encodeToByteArray() val hash = kdf.hash(value, salt)
val hash = kdf.hash(value, salt, 100_000, 32)
} }
``` ```