Files
encoding.kt/README.md
2026-01-17 12:36:16 +01:00

41 lines
726 B
Markdown

# encoding-kt
`encoding-kt` is a Kotlin Multiplatform library that provides common `ByteArray` encodings.
Supported encodings:
- Base2 (binary)
- Base8 (octal)
- Base16 (hexadecimal)
- Base32
- Base36
- Base62
- Base64
## Installation
Add the following to your `build.gradle.kts`.
```kotlin
repositories {
maven("https://git.infendro.com/api/packages/Infendro/maven")
}
dependencies {
implementation("com.infendro:encoding:1.3.0")
}
```
## Usage
```kotlin
fun main() {
// the string to encode
val test = "Hello World!".encodeToByteArray()
// encode the string with the desired encoding
val encoded = Base16.encode(test).decodeToString()
println(encoded) // 48656c6c6f20576f726c6421
}
```