Crockford
Base32 encoding/decoding in accordance with the Crockford Spec
e.g.
val crockford = Base32.Crockford.Builder {
isLenient(enable = true)
encodeLowercase(enable = false)
hyphen(interval = 5)
check(symbol = '~')
backFillBuffers(enable = true)
}
val text = "Hello World!"
val bytes = text.encodeToByteArray()
val encoded = bytes.encodeToString(crockford)
println(encoded) // 91JPR-V3F41-BPYWK-CCGGG~
// Alternatively, use the static implementation containing
// pre-configured settings, instead of creating your own.
val decoded = encoded.decodeToByteArray(Base32.Crockford).decodeToString()
assertEquals(text, decoded)Content copied to clipboard
See also
Types
Link copied to clipboard
A static instance of EncoderDecoder configured with a Crockford.Builder.hyphen interval of 4, and remaining Crockford.Builder DEFAULT values.
Link copied to clipboard
Holder of a configuration for the Crockford encoded/decoder instance.