Skip to content

germandiagogomez/onionbase85

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Readme

Project motivation

I found a site called “Tom’s data onion” here. I was curious to decode the payload presented in the website myself by doing some coding.

That way I could train some Modern C++ skills + tooling and see how efficiently it works. I gave it the name onionbase85 as a tribute to that website.

So this project includes (only) a Base85 decoder library that is able to decode the payload shown in Tom’s data onion website. And only that.

In the first place I wanted to check how efficient is nowadays a modern C++ toolchain compared with other languages:

  1. Use a sane build system
  2. Add some dependencies via package management
  3. Use some TDD to code the decoder
  4. Add a benchmark for the decoder

The project is using C++2a (through gcc 9 and Linux is how I did it, but this should work in Linux and Mac equally well, it is all standard C++ + some dependencies). There were some missing pieces I wanted to use from C++20 so I used alternatives such as microsoft-gsl via meson wrap packages. I also used Catch2 for the tests.

All in all, it took some 5-6 hours to do all the work together in a couple of days.

I am quite happy with the result compared to how C++ was one decade ago. No wonder that much progress has been done.

How to use this project

Dependencies

This project uses the Meson Build System. My recommendation is that you install it via python pip.

You will also need Ninja build system if you use ninja as the backend (the default).

The project has been coded and tested under Ubuntu Linux but it should work reliably in Mac OS and on Windows if you use it as a static library (no dllexport implemented as of now).

Building the project

This project is a standard Meson project. All commands that you will see below must be executed from the root directory. There are more ways, but I will keep it like this for the sake of simplicity.

  1. Clone the github project.
git clone https://github.com/germandiagogomez/onionbase85.git
  1. Invoke meson to build the project
meson -Ddefault_library=static build

The output of the project is a library, by default a shared library. Not terribly useful to test it or run it.

So take a look at the options:

meson configure build

You will see at the end 2 options: build-tests and build-benchmarks.

So use those:

meson configure -Dbuild-benchmarks=true -Dbuild-tests=true build

You can do all of the above meson configuration in a single command via meson -Dbuild-benchmarks=true -Dbuild-tests=true -Ddefault_library=static build if you wish so.

Using the visual studio backend to open with Visual studio (Windows)

meson -Dbuild-benchmarks=true -Dbuild-tests=true -Ddefault_library=static --backend=vs2019 build

Running the tests

meson test -v

If you want to see the output of the test payload:

ONION_DEBUG_PAYLOAD=1 meson test -v

Running the benchmarks

meson test -v --benchmark

Related articles

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published