update README
This commit is contained in:
35
README.md
35
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)
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user