@@ -44,26 +44,18 @@ representations:
4444 produces short, deterministic string representations suitable for external
4545 identifiers.
4646
47- These components define explicit data layouts and predictable output lengths,
48- enabling efficient transport, storage, and comparison of serialized values.
49- ---
50-
51- ## Installation
47+ ### Installation
5248
5349``` kotlin
5450dependencies {
5551 implementation(" com.eignex:kencode:1.0.0" )
56-
57- // For serialization support
58- implementation(" org.jetbrains.kotlinx:kotlinx-serialization-core:1.9.0" )
5952}
6053```
6154
62- You also need to load the serialization plugin.
63-
64- ---
55+ For PackedFormat and EncodedFormat you also need you also need to load the
56+ serialization plugin.
6557
66- ## Full serialization example
58+ ### Full serialization example
6759
6860Minimal example using the default ` EncodedFormat ` (` Base62 ` + ` PackedFormat ` ):
6961
@@ -103,9 +95,16 @@ val decoded = EncodedFormat.decodeFromString<Payload>(encoded)
10395
10496You can use the encoders standalone on raw byte arrays.
10597
106- ### 2. Update the ** ProtoBuf serialization** section
107-
108- The motivation is now changed from "complexity" to "interoperability."
98+ ``` kotlin
99+ val bytes = " any byte data" .encodeToByteArray()
100+ println (Base36 .encode(bytes)) // 0ksef5o4kvegb70nre15t
101+ println (Base62 .encode(bytes)) // 2BVj6VHhfNlsGmoMQF
102+ println (Base64 .encode(bytes)) // YW55IGJ5dGUgZGF0YQ==
103+ println (Base85 .encode(bytes)) // @;^?5@X3',+Cno&@/
104+
105+ // Decoding is symmetric:
106+ val back = Base62 .decode(" 2BVj6VHhfNlsGmoMQF" )
107+ ```
109108
110109---
111110
@@ -126,7 +125,7 @@ val encoded = format.encodeToString(payload) // 05cAKYGWf6gBgtZVpkqPEWOYH
126125val decoded = format.decodeFromString<ProtoBufRequired >(encoded)
127126```
128127
129- This example relies on kotlinx protobuf, which you install:
128+ This example relies on kotlinx protobuf, which you install like so :
130129
131130``` kotlin
132131implementation(" org.jetbrains.kotlinx:kotlinx-serialization-protobuf:1.9.0" )
@@ -185,8 +184,8 @@ val result: SensitiveData = PackedFormat.decodeFromByteArray(decrypted)
185184
186185## Checksums
187186
188- You can add a CRC checksum to an ` EncodedFormat ` . On decode, a mismatch
189- throws, so you get a simple integrity check on the serialized payload.
187+ You can add a CRC checksum to an ` EncodedFormat ` , this is built in . On decode, a
188+ mismatch throws, so you get a simple integrity check on the serialized payload.
190189
191190``` kotlin
192191@Serializable
0 commit comments