update README

This commit is contained in:
2025-12-13 23:01:04 +01:00
parent f147058b6c
commit 8065f15e3f
2 changed files with 21 additions and 15 deletions

View File

@@ -1,15 +1,18 @@
# Kotlin MAC
# mac-kt
This library provides various [Message Authentication Code](https://en.wikipedia.org/wiki/Message_authentication_code) implementations in Kotlin Multiplatform.
`mac-kt` is a Kotlin Multiplatform library that provides common MAC implementations.
## Features
Supported MACs:
- HMAC
* Generate message authentication codes.
* [HMAC](https://en.wikipedia.org/wiki/HMAC)
* Multiplatform support
* JVM
* JavaScript
* Native (Linux)
## Targets
| Target | Status |
|------------------|---------------|
| JVM | Supported |
| JavaScript | Supported |
| Native (Linux) | Supported |
| Native (Windows) | Not Supported |
## Installation
@@ -21,14 +24,14 @@ repositories {
}
dependencies {
implementation("com.infendro:mac:1.2.2")
implementation("com.infendro:mac:1.2.0")
}
```
## Usage
```kotlin
import com.infendro.hash.SHA1
import com.infendro.hash.sha1.SHA1
import com.infendro.mac.HMAC
fun main() {
@@ -36,8 +39,10 @@ fun main() {
val hmac = HMAC(SHA1)
// generate MAC
val key = "secret".encodeToByteArray()
val value = "Hello World!".encodeToByteArray()
val key = "secret"
.encodeToByteArray().asUByteArray()
val value = "Hello World!"
.encodeToByteArray().asUByteArray()
val mac = hmac.hash(key, value)
}
```