Files
kdf.kt/README.md
2026-04-16 16:10:03 +00:00

790 B

kdf.kt

kdf.kt is a Kotlin Multiplatform library that provides common Key Derivation Functions.

Supported algorithms:

  • PBKDF2

Installation

Add the following to your build.gradle.kts.

repositories {
    maven("https://git.infendro.com/api/packages/Infendro/maven")
}

dependencies {
    implementation("com.infendro:kdf:1.2.1")
}

Usage

fun main() {
    // create a PBKDF2 instance using HMAC SHA-256
    //   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
    val value = "password".encodeToByteArray()
    val salt = "salt".encodeToByteArray()
    val hash = kdf.hash(value, salt)
}