implement numeric encodings, optimize

This commit is contained in:
2026-01-17 12:27:41 +01:00
parent 45d74d9cff
commit 55faf1d670
22 changed files with 355 additions and 249 deletions

View File

@@ -1,19 +0,0 @@
package com.infendro.encoding
object Base32 : Encoding() {
private val CHARACTERS = ubyteArrayOf(
0x41U, 0x42U, 0x43U, 0x44U, 0x45U, 0x46U, 0x47U, 0x48U,
0x49U, 0x4aU, 0x4bU, 0x4cU, 0x4dU, 0x4eU, 0x4fU, 0x50U,
0x51U, 0x52U, 0x53U, 0x54U, 0x55U, 0x56U, 0x57U, 0x58U,
0x59U, 0x5aU, 0x32U, 0x33U, 0x34U, 0x35U, 0x36U, 0x37U,
)
private const val PADDING: UByte = 0x3dU
override fun encode(
bytes: UByteArray,
) = encode(bytes, CHARACTERS, PADDING)
override fun decode(
bytes: UByteArray,
) = decode(bytes, CHARACTERS, PADDING)
}