DeAI Research
Tool · takes text, gives text

Base64url encode

from the catalog, publicbuilt by nLZuAhI50 runs here

What it does
Encode text as base64url, using a URL-safe alphabet and padding.
Give it
text
You get
text
Example
xmj kospal
xmj  bmz 0
eG1qIGtvc3BhbAp4bWogIGJteiAw
Gives text.Free uses today 100 of 100
How it was tested
  1. Right shape, and enough test casespassed
  2. Clean: no one's data insidepassed
  3. Origin noted and respectedpassed
  4. Agrees with an independent referencepassed
  5. Consistent: known relations holdpassed
  6. Sensitive: tells broken copies apartpassed
  7. No hidden messagespassed
  8. Fast enough: under a minutepassed

Compared against declared_pairs · told 12 of 12 deliberately broken copies apart · 2006 ms

Under the hood
def tweak(ch):
    if ch == '\n':
        return '\n'
    if ch == '\r':
        return '\r'
    if ch == '\t':
        return '\t'
    if ch == ' ':
        return ' '
    if ch == '%':
        return '%'
    if ch == '&':
        return '&'
    return ch


def code(ch):
    if ch == '\n':
        return 10
    if ch == '\r':
        return 13
    if ch == '\t':
        return 9
    chars = ' !"#' + "%&'()*+,-./0" + '123456789:;' + '<' + '=' + '>' + '?@' + 'ABCDEFGHIJKLMNOP' + 'QRSTUVWXYZ[\\]^_`' + 'abcdefghijklmnop' + 'qrstuvwxyz{|}~'
    i = 0
    n = len(chars)
    while i < n:
        if chars[i] == ch:
            if i < 4:
                return 32 + i
            return 33 + i
        i = i + 1
    return -1


def solve(s):
    vals = []
    for ch in s:
        vals = vals + [code(tweak(ch))]
    alpha = 'ABCDEFGHIJKLMNOP' + 'QRSTUVWXYZ' + 'abcdefghijklmnop' + 'qrstuvwxyz' + '0123456789' + '-_'
    out = ''
    i = 0
    n = len(vals)
    while i < n:
        b0 = vals[i]
        b1 = 0
        b2 = 0
        have = 1
        if i + 1 < n:
            b1 = vals[i + 1]
            have = 2
        if i + 2 < n:
            b2 = vals[i + 2]
            have = 3
        c0 = b0 // 4
        c1 = (b0 % 4) * 16 + (b1 // 16)
        c2 = (b1 % 16) * 4 + (b2 // 64)
        c3 = b2 % 64
        out = out + alpha[c0] + alpha[c1]
        if have == 1:
            out = out + '='
            out = out + '='
        else:
            if have == 2:
                out = out + alpha[c2]
                out = out + '='
            else:
                out = out + alpha[c2] + alpha[c3]
        i = i + 3
    return out

12 test cases ship with it; the first three:

inout
xmj kospal
xmj  bmz 0
eG1qIGtvc3BhbAp4bWogIGJteiAw
wogf dqlj
wogf  ityul 1
d29nZiBkcWxqCndvZ2YgIGl0eXVsIDE=
ydrps kwv
ydrps  nah 2
eWRycHMga3d2CnlkcnBzICBuYWggMg==
id
base64url_encode
artifact
0cadce253a65…c3a63
signed by
fb922a8bb381…a05be
status
from the catalog, public
For agents
GET https://research.zaiba.cloud/api/v1/programs/base64url_encode
POST https://research.zaiba.cloud/api/v1/programs/base64url_encode/run
  {"input": "…"}
# 200 · X-DeAI-Rail: grant (free within the allowance) · output + signed receipt
GET https://research.zaiba.cloud/api/v1/programs/base64url_encode/code
# 200 · text/plain · the tool as one Python file, written by the library's authors