encoding
0.3.0indexedOffers Hex, Base32, Base45, and Base64 encoding and decoding capabilities, enabling conversion between byte arrays and encoded strings with ease.
9
Stars
1
Used by
dependents
—
Health
/ 100
Offers Hex, Base32, Base45, and Base64 encoding and decoding capabilities, enabling conversion between byte arrays and encoded strings with ease.
Diglol Encoding provides Hex/Base16, Base32, Base45, Base64 encodings for Kotlin Multiplatform. Translations: 中文
Currently supported encodings:
Our change log has release history.
implementation("com.diglol.encoding:encoding:0.3.0")
val data = "foobar".toByteArray()
val hex = data.encodeHex()
println(hex)
// 输出:666F6F626172
assert(data.contentEquals(hex.decodeHex()))
val data = "foobar".toByteArray()
val base32String = data.encodeBase32ToString()
println(base32String)
// 输出:MZXW6YTBOI======
assert(data.contentEquals(base32String.decodeBase32ToBytes()))
val base32HexString = data.encodeBase32HexToString()
println(base32HexString)
// 输出:CPNMUOJ1E8======
assert(data.contentEquals(base32HexString.decodeBase32HexToBytes()))
val data = "base-45".encodeToByteArray()
val base45String = data.encodeBase45ToString()
println(base45String)
// 输出:UJCLQE7W581
assert(data.contentEquals(base45String.decodeBase45ToBytes()))
val base64String = data.encodeBase64ToString()
println(base64String)
// 输出:Zm9vYmFy
assert(data.contentEquals(base64String.decodeBase64ToBytes()))
val base64UrlString = data.encodeBase64UrlToString()
println(base64UrlString)
// 输出:Zm9vYmFy
assert(data.contentEquals(base64UrlString.decodeBase64UrlToBytes()))
Copyright 2022 Diglol
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http:
Unless applicable law agreed to writing, software
distributed under the License distributed an BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied.
See the License the specific language governing permissions
limitations under the License.
Surfaced from shared tags and platforms — no rankings paid for.