Skip to content


Repository files navigation

CHES 2022 - White-box Cryptography Tutorial

Authors: Matthieu Rivain and Aleksei Udovenko

This repository contains preparation instructions and notebooks for the WBC tutorial at CHES 2022.

Warning: this is an archive repository and is outdated. See wboxkit repo for updated library and tutorials.

Note: the repository is currently assembled primarily for the tutorial at CHES 2022; a large part of the tutorial should be runnable with just pip install circkit wboxkit and the jupyter lab / notebook. However, some parts (e.g. wboxkit.fastcircuit compilation) are not yet automatically built when installing from pip (will be fixed soon).

The main repository for circkit is: The tutorial was prepared using a local copy of circkit in this repository, but pip install circkit should also work.

Minimal Setup (pure Python)

Might be slow and LDA won't work.

sudo apt install graphviz

pip install jupyterlab binteger pycryptodome graphviz

Running notebooks:

jupyter lab

Running tools/attacks:

python3 tools/ ...
python3 attacks/ ....

Setup (using Docker)

The simplest is to use the prepared docker image.

WARNING: as the image is quite large (4.5 GiB) due to SageMath, it is recommended to download it in advance:

sudo docker pull hellman1908/ches2022wbc

Then, run as follows:

git clone

# run Jupyter Notebook
sudo docker run -it \
	--network=host \
	-v `pwd`/ches2022wbc:/home/user/ches2022wbc \

# run shell
sudo docker run -it \
	--network=host \
	-v `pwd`/ches2022wbc:/home/user/ches2022wbc \
	hellman1908/ches2022wbc /bin/bash

Then, Ctrl+Click or copy/paste the link

Alternatively, a lightweight image (without SageMath) can be installed:

sudo docker pull hellman1908/ches2022wbc_nosagemath
git clone
sudo docker run -it \
	--network=host \
	-v `pwd`/ches2022wbc:/home/user/ches2022wbc \

Note: without host network, try running

sudo docker run -it \
	-p \
	-v `pwd`/ches2022wbc:/home/user/ches2022wbc \
	hellman1908/ches2022wbc_nosagemath \
	jupyter lab --no-browser --port=9999 --ip=

Setup (using Linux)


  1. Install SageMath (only needed for linear algebraic attack)
  2. Install pypy3 (much faster circuit gen. and attacks)


  1. Install jupyter lab (any python env.)
pip install jupyterlab
  1. Install ipykernel for the pypy3 interpreter, e.g.:
pypy3 -m pip install -U pip
pypy3 -m pip install -U pycryptodome binteger ipykernel jupyter_client
pypy3 -m ipykernel install --prefix=$HOME/.local/ --name 'pypy3'

jupyter kernelspec list
  1. Clone this repository and compile the fastcircuit library:
git clone
cd ches2022wbc
  1. Test running jupyter as
jupyter lab

Then, Ctrl+Click or copy/paste the link

You can also try opening the Tutorial 0 - Test Setup.ipynb in the ches2022wbc repository, and executing the code cell.


CHES 2022 White-box Cryptography Tutorial






No releases published