Log inBook a Demo
BuildJuniorBackendAuto-graded

Write base64 encode and decode from scratch

Implement RFC 4648 base64 without the base64 or binascii modules. The output must match the standard and decode back unchanged.b64encode and b64decode in codec.py look finished. For some inputs the output differs from what any standard base64 tool gives, and some data doesn't come back the same after a decode. Both have to match RFC 4648 exactly, for any length and any byte values. Write the bit handling yourself: importing base64 or binascii is not allowed.
30 min
python

You're done when

  • Encoding matches standard base64 for every input, binary data included.
  • Every input length encodes as the standard says, = padding included.
  • Decoding what you encoded gives back exactly the bytes you started with.
  • Decoding base64 produced by any standard tool returns the original bytes.

What it measures

Data structures and algorithmsRegrouping 8-bit bytes into 6-bit symbols correctly, whatever the input length.
Working to a specificationMatching a published standard character for character.
Debugging and verificationTesting beyond the common cases, against the standard and with round trips.

Your environment

Terminal + editorA full shell in the browser
Claude CodePre-authenticated, no key setup
Isolated microVMYours alone, wiped afterwards

Start this lab

30 min
Start labYou'll sign in to Anthropos to start. The lab opens in a private cloud workspace with Claude Code ready to use.
AI Labs is part of Anthropos Workforce. Not on your plan yet? Book a demo