This commit is contained in:
31
src/commonMain/kotlin/com/infendro/encoding/Base32.kt
Normal file
31
src/commonMain/kotlin/com/infendro/encoding/Base32.kt
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.infendro.encoding
|
||||
|
||||
object Base32 : Encoding() {
|
||||
private val CHARACTERS = arrayOf<Byte>(
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
|
||||
0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
|
||||
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
|
||||
0x59, 0x5a, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
|
||||
)
|
||||
private const val PADDING: Byte = 0x3d
|
||||
|
||||
override fun encode(
|
||||
bytes: ByteArray,
|
||||
): ByteArray {
|
||||
return encode(
|
||||
bytes,
|
||||
CHARACTERS,
|
||||
PADDING,
|
||||
)
|
||||
}
|
||||
|
||||
override fun decode(
|
||||
bytes: ByteArray,
|
||||
): ByteArray {
|
||||
return decode(
|
||||
bytes,
|
||||
CHARACTERS,
|
||||
PADDING,
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user