add README
This commit is contained in:
43
README.md
Normal file
43
README.md
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Kotlin MAC
|
||||||
|
|
||||||
|
This library provides various Message Authentication Code implementations in Kotlin Multiplatform.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
* Generate message authentication codes.
|
||||||
|
* [HMAC](https://en.wikipedia.org/wiki/HMAC)
|
||||||
|
* 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:mac:1.2.2")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
import com.infendro.hash.SHA1
|
||||||
|
import com.infendro.mac.HMAC
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
// create an HMAC instance using SHA1
|
||||||
|
val hmac = HMAC(SHA1)
|
||||||
|
|
||||||
|
// generate MAC
|
||||||
|
val key = "secret".encodeToByteArray()
|
||||||
|
val value = "Hello World!".encodeToByteArray()
|
||||||
|
val mac = hmac.hash(key, value)
|
||||||
|
}
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user