1.2.0 release #2

Merged
Infendro merged 6 commits from develop into main 2025-11-18 10:32:05 +00:00
7 changed files with 38 additions and 67 deletions
Showing only changes of commit 12344283f7 - Show all commits

View File

@@ -1,6 +1,6 @@
package com.infendro.encoding
object Hex : Encoding() {
object Base16 : Encoding() {
private val CHARACTERS = ubyteArrayOf(
0x30U, 0x31U, 0x32U, 0x33U, 0x34U, 0x35U, 0x36U, 0x37U,
0x38U, 0x39U, 0x61U, 0x62U, 0x63U, 0x64U, 0x65U, 0x66U,
@@ -8,19 +8,9 @@ object Hex : Encoding() {
override fun encode(
bytes: UByteArray,
): UByteArray {
return encode(
bytes,
CHARACTERS,
)
}
) = encode(bytes, CHARACTERS)
override fun decode(
bytes: UByteArray,
): UByteArray {
return decode(
bytes,
CHARACTERS,
)
}
) = decode(bytes, CHARACTERS)
}

View File

@@ -0,0 +1,15 @@
package com.infendro.encoding
object Base2 : Encoding() {
private val CHARACTERS = ubyteArrayOf(
0x30U, 0x31U,
)
override fun encode(
bytes: UByteArray,
) = encode(bytes, CHARACTERS)
override fun decode(
bytes: UByteArray,
) = decode(bytes, CHARACTERS)
}

View File

@@ -11,21 +11,9 @@ object Base32 : Encoding() {
override fun encode(
bytes: UByteArray,
): UByteArray {
return encode(
bytes,
CHARACTERS,
PADDING,
)
}
) = encode(bytes, CHARACTERS, PADDING)
override fun decode(
bytes: UByteArray,
): UByteArray {
return decode(
bytes,
CHARACTERS,
PADDING,
)
}
) = decode(bytes, CHARACTERS, PADDING)
}

View File

@@ -15,21 +15,9 @@ object Base64 : Encoding() {
override fun encode(
bytes: UByteArray,
): UByteArray {
return encode(
bytes,
CHARACTERS,
PADDING,
)
}
) = encode(bytes, CHARACTERS, PADDING)
override fun decode(
bytes: UByteArray,
): UByteArray {
return decode(
bytes,
CHARACTERS,
PADDING,
)
}
) = decode(bytes, CHARACTERS, PADDING)
}

View File

@@ -0,0 +1,15 @@
package com.infendro.encoding
object Base8 : Encoding() {
private val CHARACTERS = ubyteArrayOf(
0x30U, 0x31U, 0x32U, 0x33U, 0x34U, 0x35U, 0x36U, 0x37U,
)
override fun encode(
bytes: UByteArray,
) = encode(bytes, CHARACTERS)
override fun decode(
bytes: UByteArray,
) = decode(bytes, CHARACTERS)
}

View File

@@ -1,25 +0,0 @@
package com.infendro.encoding
object Binary : Encoding() {
private val CHARACTERS = ubyteArrayOf(
0x30U, 0x31U,
)
override fun encode(
bytes: UByteArray,
): UByteArray {
return encode(
bytes,
CHARACTERS,
)
}
override fun decode(
bytes: UByteArray,
): UByteArray {
return decode(
bytes,
CHARACTERS,
)
}
}

View File

@@ -61,7 +61,7 @@ sealed class Encoding {
padding: UByte? = null,
): UByteArray {
val length = log2(characters.size).toInt()
val mask = 0xFFU
val mask = 0xffU
val decoded = mutableListOf<UByte>()