implement optimizations
This commit is contained in:
20
README.md
20
README.md
@@ -1,19 +1,10 @@
|
||||
# mac-kt
|
||||
|
||||
`mac-kt` is a Kotlin Multiplatform library that provides common [Message Authentication Code](https://en.wikipedia.org/wiki/Message_authentication_code) algorithms.
|
||||
`mac-kt` is a Kotlin Multiplatform library that provides common [Message Authentication Codes](https://en.wikipedia.org/wiki/Message_authentication_code).
|
||||
|
||||
Supported algorithms:
|
||||
- HMAC
|
||||
|
||||
## Targets
|
||||
|
||||
| Target | Status |
|
||||
|------------------|---------------|
|
||||
| JVM | Supported |
|
||||
| JavaScript | Supported |
|
||||
| Native (Linux) | Supported |
|
||||
| Native (Windows) | Not Supported |
|
||||
|
||||
## Installation
|
||||
|
||||
Add the following to your `build.gradle.kts`.
|
||||
@@ -31,18 +22,13 @@ dependencies {
|
||||
## Usage
|
||||
|
||||
```kotlin
|
||||
import com.infendro.hash.sha1.SHA1
|
||||
import com.infendro.mac.HMAC
|
||||
|
||||
fun main() {
|
||||
// create an HMAC instance using SHA1
|
||||
val hmac = HMAC(SHA1)
|
||||
|
||||
// generate MAC
|
||||
val key = "secret"
|
||||
.encodeToByteArray().asUByteArray()
|
||||
val value = "Hello World!"
|
||||
.encodeToByteArray().asUByteArray()
|
||||
val key = "secret".encodeToByteArray()
|
||||
val value = "Hello World!".encodeToByteArray()
|
||||
val mac = hmac.hash(key, value)
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user