Tags: record, encoding
Lace needs binary protocol values to be safe in paths, stable in text, and sortable without decoding. Base64-Ascend, abbreviated B64A, is the canonical text encoding for Lace hashes, verifiers, signing secrets, and signatures. Its alphabet is ASCII-sorted so equal-length encoded strings sort in decoded byte order.
This document is for record and crypto implementors. After reading it, an implementor should be able to encode canonical B64A text, reject non-canonical forms, and rely on text ordering for equal-length decoded values.
Alphabet, encoding, decoding, ordering, and test vectors.
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~
Symbol indexes are assigned left to right: 0..9,
A..Z, _, a..z, then
~.
Implementations MUST encode bytes as follows:
The encoded length is ceil(8*N/6) for N
input bytes.
Implementations MUST reject text that contains bytes outside the B64A alphabet or contains padding.
After decoding, implementations MUST validate canonical length and zero-filled tail bits:
Equal-length canonical B64A strings compare in the same order as their decoded bytes. If one canonical string is a strict prefix of another, the shorter string sorts first.
| Hex | B64A |
|---|---|
| empty | empty |
00 |
00 |
0000 |
000 |
000000 |
0000 |
FF |
~l |
FF00 |
~l0 |
000102 |
0042 |
Reject examples: 01, 001, ~m,
~l1, =, +, /.