Stdlib index
- Captured-borrow migration worklist (3.3.3)
- Owned-bind migration worklist (8.2.7)
- Return-side title audit — the ride-through enumeration
- stdlib ownership audit
- stdlib ownership dispositions (plan 1.3.1 / 4.3.1)
aot
codec
codec / csv
codec / json
collection
- ArrayList
- BPlusTree
- Cache
- Collectors
- HashMap
- HashSet
- Heap
- ImmutableList
- ImmutableMap
- ImmutableSet
- LinkedList
- RedBlackTree
- Sort
collection / ltm
concurrent
error
- Exception
- NoOptionalValueException
- NotProvidedException
- RecoverableException
- ScopedBuildFailedException
- ScopeNotActiveException
- Throwable
- UnrecoverableException
gfx
hash
ifx
io
io / file
io / net
io / net / dns
io / net / uri
lang
lang / stream
math
math / fft
math / linalg
math / npio
math / poly
math / random
math / stats
nucleo
- Columns — the Arrow-laid-out substrate
- Fused tensor expressions — Fuse
- Table — the lazy, typed dataframe
- Tape — define-by-run autograd
- Transform intrinsics — Grad, Vmap, Jit
process
reflect
search / distance
search / fuzzy
search / ngram
session
time
- Clock
- DateTimeFormatter
- Duration
- Instant
- LocalDate
- LocalDateTime
- LocalTime
- Period
- ZonedDateTime
- ZoneId
- ZoneOffset
wire
xpu
xpu / mesh
Base32
cajeta.codec.Base32 — Base32 (RFC 4648 §6) byte ⇄ text codec, the alphabet
A–Z 2–7. Its one everyday use is the shared secret in an otpauth://
enrollment URI, which authenticator apps read and people sometimes type, so
decoding accepts lowercase and tolerates missing = padding. A character
outside the alphabet or a length no byte sequence produces raises
Base32Exception with the offending byte offset.
int8[] secret = heap int8[20];
String padded #= Base32.encode(secret, (int64) secret.count()); // 32 chars, no '=' at 20 bytes
String bare #= Base32.encode(secret, (int64) secret.count(), false); // never padded
int8[] raw #= Base32.decode("mzxw6ytboi"); // "foobar"
Methods
| Signature | |
|---|---|
static #String encode(int8[] data, int64 len) | Encode data[0..len) with = padding to a multiple of 8 |
static #String encode(int8[] data, int64 len, boolean pad) | Encode with padding chosen explicitly |
static #int8[] decode(String s) | Decode upper or lower case, padded or not; throws Base32Exception on garbage |
static #int8[] decodeBytes(int8[] data, int64 len) | Decode data[0..len) held as bytes |
See also
- Base64 — the codec for everything that is not an OTP secret
- Source:
runtime/src/cajeta/codec/Base32.cajeta