From Base64

Category: Encoding

Status: Registered and callable in the CyberChef 11.3.0 compatibility inventory.

Input / output: string → byteArray

Background: https://wikipedia.org/wiki/Base64

What it does

Base64 is a notation for encoding arbitrary byte data using a restricted set of symbols that can be conveniently used by humans and processed by computers. This operation decodes data from an ASCII Base64 string back into its raw format. e.g. aGVsbG8= becomes hello

Note

Status here means the operation name is implemented and callable. It does not by itself promise byte-for-byte parity for every upstream option. See Compatibility and current status for the verified scope and known boundaries.

Arguments and options

Arguments are positional. Keep their order when using bake() or Pipeline.then().

Index

Name

UI type

PyChef default

Accepted values / format

0

Alphabet

editableOption

'A-Za-z0-9+/='

'A-Za-z0-9+/=', 'A-Za-z0-9-_', 'A-Za-z0-9+\\-=', './0-9A-Za-z=', 'A-Za-z0-9_.', 'A-Za-z0-9._-', '0-9a-zA-Z+/=', '0-9A-Za-z+/=', ' -_', '+\\-0-9A-Za-z', '!-,-0-689@A-NP-VX-Z[`a-fh-mp-r', 'N-ZA-Mn-za-m0-9+/=', './0-9A-Za-z', '/128GhIoPQROSTeUbADfgHijKLM+n0pFWXY456xyzB7=39VaqrstJklmNuZvwcdEC', '3GHIJKLMNOPQRSTUb=cdefghijklmnopWXYZ/12+406789VaqrstuvwxyzABCDEF5', 'ZKj9n+yf0wDVX1s/5YbdxSo=ILaUpPBCHg8uvNO4klm6iJGhQ7eFrWczAMEq3RTt2', 'HNO4klm6ij9n+J2hyf0gzA8uvwDEq3X1Q7ZKeFrWcVTts/MRGYbdxSo=ILaUpPBC5'

1

Remove non-alphabet chars

boolean

True

True or False

2

Strict mode

boolean

False

True or False

Working recipe example

from pychef import bake

input_value = "SGVsbG8="
args = ['A-Za-z0-9+/=', True, False]
result = bake(input_value, [{"op": 'From Base64', "args": args}])
print(result)

Expected representation: b'Hello'.

Pipeline example

from pychef import Pipeline

args = ['A-Za-z0-9+/=', True, False]
transform = Pipeline().then('From Base64', *args)
result = transform("SGVsbG8=")

Direct call

pychef.ops.run_operation runs any registered operation as a plain function, under the active ExecutionPolicy (safe defaults, no network):

from pychef.ops import run_operation

args = ['A-Za-z0-9+/=', True, False]
result = run_operation('From Base64', "SGVsbG8=", args=args)

Common operations also have typed helpers in Direct operations.

Low-level operation module

Warning

The module below is an internal implementation detail. It applies no execution policy, resource limits, or error sanitization; prefer bake(), Pipeline, or pychef.ops for application code.

The registered entry point lives in pychef.operations.by_operation.from_base64. Direct calls receive the input value and a positional argument tuple:

from pychef.operations.by_operation.from_base64 import run

result = run("SGVsbG8=", tuple(['A-Za-z0-9+/=', True, False]))
pychef.operations.by_operation.from_base64.run(value, args)

Run this operation using its shared internal implementation.

Parameters:
  • value (str | bytes)

  • args (Sequence[Any])

Return type:

str | bytes