add README
This commit is contained in:
44
README.md
Normal file
44
README.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# Kotlin KDF
|
||||
|
||||
This library provides various [Key Derivation Function](https://en.wikipedia.org/wiki/Key_derivation_function)
|
||||
implementations in Kotlin Multiplatform.
|
||||
|
||||
## Features
|
||||
|
||||
* [PBKDF2](https://en.wikipedia.org/wiki/PBKDF2)
|
||||
* Multiplatform support
|
||||
* JVM
|
||||
* JavaScript
|
||||
* Native (Linux)
|
||||
|
||||
## Installation
|
||||
|
||||
Add the following to your `build.gradle.kts`.
|
||||
|
||||
```kotlin
|
||||
repositories {
|
||||
maven("https://git.infendro.com/api/packages/Infendro/maven")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.infendro:kdf:1.0.3")
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```kotlin
|
||||
import com.infendro.hash.SHA256
|
||||
import com.infendro.kdf.PBKDF2
|
||||
|
||||
fun main() {
|
||||
// create a PBKDF2 instance using HMAC SHA256
|
||||
val kdf = PBKDF2(SHA256)
|
||||
|
||||
// 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)
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user