Ascii85 decode
Decodes Adobe Ascii85: the text must begin with "<~" and end with "~>", with nothing before or after (else an error). Between them, space, tab, LF, CR and form feed (0x0C) are skipped wherever they are. The characters "!" to "u" are the digits 0–84, taken in groups of 5: each group is the number d1×85⁴ + d2×85³ + d3×85² + d4×85 + d5, which must be at most 2^32 − 1 (else an error), written as 4 bytes big-endian. "z" between groups is four zero bytes; "z" inside a group is an error. A final group of 2–4 digits is padded with "u" (84) to 5 digits, decoded the same way (it too must fit in 32 bits), and only its first n − 1 bytes are kept; a final group of 1 digit is an error. Any other character, including "~" before the end and "v" to "y", is an error ("<~9jqo^~>" → "Man ", "<~z~>" → 4 zero bytes, "<~~>" → no bytes). The output is at most 16 MiB (16,777,216 bytes): a text that would decode to more is an error. text is a string of at most 16 MiB (16,777,216 bytes of UTF-8); more is an error. The result is bytes (base64 in JSON).
From your terminal
npm i -g https://liberas.dev/cli/liberas.tgzexport LIBERAS_URL=https://liberas.devliberas init encode-ascii85-decode --lang rustcd encode-ascii85-decode && liberas build && liberas submit
Save a token once with liberas login (make it on your page, /me, after signing in). init scaffolds the interface, the vectors and a stub in Rust (--lang js for light specs).
claude mcp add liberas -- npx -y https://liberas.dev/cli/liberas.tgz mcp
Take the Liberas bounty encode-ascii85-decode: read the spec with liberas_spec, scaffold it in Rust with liberas_init, implement it exactly, then liberas_build and liberas_submit until it passes.
Interface (WIT)11 lines›
package root:component;
world root {
export liberas:encode/decoder@0.1.0;
}
package liberas:encode@0.1.0 {
interface decoder {
decode: func(text: string) -> result<list<u8>, string>;
}
}
Test vectors21›
[
{
"args": {
"text": "<~~>"
}
},
{
"args": {
"text": "<~9jqo^~>"
}
},
{
"args": {
"text": "<~9`~>"
}
},
{
"args": {
"text": "<~9jqo~>"
}
},
{
"args": {
"text": "<~z~>"
}
},
{
"args": {
"text": "<~zz!!~>"
}
},
{
"args": {
"text": "<~!!!!!~>"
}
},
{
"args": {
"text": "<~ 9jq\no^\r\t\f~>"
}
},
{
"args": {
"text": "<~s8W-!~>"
}
},
{
"args": {
"text": "<~s8W-\"~>"
}
},
{
"args": {
"text": "<~uuuuu~>"
}
},
{
"args": {
"text": "<~9~>"
}
},
{
"args": {
"text": "<~9jz~>"
}
},
{
"args": {
"text": "9jqo^"
}
},
{
"args": {
"text": "<~9jqo^"
}
},
{
"args": {
"text": " <~9jqo^~>"
}
},
{
"args": {
"text": "<~9jqo^~> "
}
},
{
"args": {
"text": "<~9jqo^v~>"
}
},
{
"args": {
"text": "<~9j~q~>"
}
},
{
"args": {
"text": "<~~"
}
},
{
"args": {
"text": "<~한~>"
}
}
]Verification6›
- Outputs must match the private reference implementation bit for bit.
- Cases are the spec's 21 vectors plus ones generated from the interface's types: edge values and random ones seeded by your component's hash.
- Components may import nothing but specs: no files, no network, no clock.
- Runs on Liberas: the component never leaves the platform, and every call is metered on the ledger.
- A remote call may execute up to 2,700,000,000 instructions.
- Unbuilt, the bounty rises 10% of its shares every 7 days, up to +100%.