Writing a ROT13 Encoder

ROT13 short for Rotate by 13 places, is a simple substitution cipher, by shifting all letters of the alphabet 13 places forward we encode a message into something unreadable, it’s a simple form of encryption based on Caesar’s cipher that existed since 1st century BC. For example the letter A becomes an N because we went forward 13 letters, repeat this for every character in a given string and you got basic encryption....

June 9, 2024 · 6 min

Writing a Brainfuck Interpreter in Python

Brainfuck is a tiny language that includes only 8 simple commands, writing an interpreter for it is easy and is often seen as a simple programming exercise. Let’s write one in Python today. Reading files First of all I’ll write a simple base to load the file given on the command line, for this I usually like to use Python’s builtin ArgumentParser: #!/usr/bin/python3 # -*- coding: utf8 -*- import sys from argparse import ArgumentParser from pathlib import Path def run(instructions: str): # TODO pass if __name__ == "__main__": parser = ArgumentParser(description="Interpret Brainfuck code") parser....

May 12, 2024 · 8 min