Hexadecimal #
Bytes ⇄ lowercase hex characters. Decoding also accepts uppercase, so shares survive being typed
by hand or "fixed" by an editor. Works on List Char so that round-trip proofs are simple
inductions; the share format turns the result into a String at the very end.
Tail-recursive versions for compiled code #
encode and decode recurse once per byte, so on a large secret the compiled code would run
out of stack. The versions below use a loop with an accumulator. Each @[csimp] theorem proves
it equal to the specification above, and the compiler then uses it in place of the
specification. The proofs keep talking about encode / decode.