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)

See also

Constructors

Link copied to clipboard
constructor(config: Base16.Config)

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 name(): String
Link copied to clipboard
Link copied to clipboard