Skip to content

2. Base32

indrajit edited this page Jul 21, 2020 · 1 revision

Base32

Encode

val encoded = Base32.encode("secret")               // Base32String => ONSWG4TFOQ
// or
val encoded = Base32.encode("secret".toByteArray()) // Base32String => ONSWG4TFOQ

Decode

encoded.decode()                                    // ByteArray
encoded.decodeAsString()                            // String => secret

Random string

Base32.random()                                     // Base32String => 4L22LJERBFGDZFQTKJZ6SDFV3OJK566Q
Base32.random(byteLength = 10)                      // Base32String => AMXTELD2SXFMDEXI
Clone this wiki locally