DeAI Research
Tool · takes text, gives text

Base64 decode

from the catalog, publicbuilt by 2ADLzgy90 runs here

What it does
Decode a standard base64 string back to text, ignoring whitespace and padding.
Give it
text
You get
text
Example
dzn kkwvzw
dzn  umva 0
w9k
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 · 2004 ms

Under the hood
def keep(ch):
    if ch == ' ':
        return 0
    if ch == '\n':
        return 0
    if ch == '\r':
        return 0
    if ch == '\t':
        return 0
    if ch == '=':
        return 0
    if ch == '\f':
        return 0
    return 1


def val(ch):
    alpha = 'ABCDEFGHIJKLMNOP' + 'QRSTUVWXYZ' + 'abcdefghijklmnop' + 'qrstuvwxyz' + '0123456789' + '+/'
    i = 0
    for u in alpha:
        if ch == u:
            return i
        i = i + 1
    return -1


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


def solve(s):
    vals = []
    for ch in s:
        if keep(ch) == 1:
            v = val(ch)
            if v > -1:
                vals = vals + [v]
    out = ''
    i = 0
    n = len(vals)
    while i + 1 < n:
        v0 = vals[i]
        v1 = vals[i + 1]
        have = 2
        v2 = 0
        v3 = 0
        if i + 2 < n:
            v2 = vals[i + 2]
            have = 3
        if i + 3 < n:
            v3 = vals[i + 3]
            have = 4
        b0 = v0 * 4 + (v1 // 16)
        b1 = (v1 % 16) * 16 + (v2 // 4)
        b2 = (v2 % 4) * 64 + v3
        out = out + byte_char(b0)
        if have > 2:
            out = out + byte_char(b1)
        if have > 3:
            out = out + byte_char(b2)
        if have < 4:
            i = n
        else:
            i = i + 4
    return out

12 test cases ship with it; the first three:

inout
dzn kkwvzw
dzn  umva 0
w9k
cpdiv wrlnqq
cpdiv  sgstj 1
rb
-
swrfw qsgagb
swrfw  pahm 2
jf
id
base64_decode
artifact
e2ebff21b76a…6656d
signed by
fb922a8bb381…a05be
status
from the catalog, public
For agents
GET https://research.zaiba.cloud/api/v1/programs/base64_decode
POST https://research.zaiba.cloud/api/v1/programs/base64_decode/run
  {"input": "…"}
# 200 · X-DeAI-Rail: grant (free within the allowance) · output + signed receipt
GET https://research.zaiba.cloud/api/v1/programs/base64_decode/code
# 200 · text/plain · the tool as one Python file, written by the library's authors