Base16
Base16 (aka "hex") encoding/decoding in accordance with RFC 4648 section 8.
https://www.ietf.org/rfc/rfc4648.html#section-8
e.g.
val base16 = Base16 {
isLenient = true
lineBreakInterval = 64
encodeToLowercase = true
}
val text = "Hello World!"
val bytes = text.encodeToByteArray()
val encoded = bytes.encodeToString(base16)
println(encoded) // 48656c6c6f20576f726c6421
// Alternatively, use the static implementaton instead of
// configuring your own settings.
val decoded = encoded.decodeToByteArray(Base16).decodeToString()
assertEquals(text, decoded)
Content copied to clipboard
See also
Types
Link copied to clipboard
Doubles as a static implementation with default settings and a lineBreakInterval of 64.
Link copied to clipboard
Configuration for Base16 encoding/decoding.
Functions
Link copied to clipboard
protected open override fun newDecoderFeedProtected(out: Decoder.OutFeed): Decoder.Feed<Base16.Config>
Link copied to clipboard
protected open override fun newEncoderFeedProtected(out: Encoder.OutFeed): Encoder.Feed<Base16.Config>