From 8552d3dd2e0368f2a7eaa37286da951dd491c023 Mon Sep 17 00:00:00 2001 From: Infendro Date: Sat, 13 Dec 2025 21:13:17 +0100 Subject: [PATCH] update README --- README.md | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index bbceabc..4c8828a 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,18 @@ -# Kotlin KDF +# kdf-kt -This library provides various [Key Derivation Function](https://en.wikipedia.org/wiki/Key_derivation_function) -implementations in Kotlin Multiplatform. +`kdf-kt` is a Kotlin Multiplatform library that provides common key derivation functions. -## Features +Supported functions: +- PBKDF2 -* [PBKDF2](https://en.wikipedia.org/wiki/PBKDF2) -* Multiplatform support - * JVM - * JavaScript - * Native (Linux) +## Targets + +| Target | Status | +|------------------|---------------| +| JVM | Supported | +| JavaScript | Supported | +| Native (Linux) | Supported | +| Native (Windows) | Not Supported | ## Installation @@ -21,24 +24,24 @@ repositories { } dependencies { - implementation("com.infendro:kdf:1.0.3") + implementation("com.infendro:kdf:1.1.0") } ``` ## Usage ```kotlin -import com.infendro.hash.SHA256 +import com.infendro.hash.`SHA-256` import com.infendro.kdf.PBKDF2 fun main() { // 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 - // this example uses 100_000 iterations and 32 bytes of length - val value = "password".encodeToByteArray() - val salt = "...".encodeToByteArray() - val hash = kdf.hash(value, salt, 100_000, 32) + val value = "password".encodeToByteArray().asUByteArray() + val salt = "salt".encodeToByteArray().asUByteArray() + val hash = kdf.hash(value, salt) } ```