This demo demonstrates the pitfalls of key re-use with one time pads. The demonstration program was pad.py.
The program consumes an image representing a one time pad key, then encrypts two different images with the same key. Finally, it XORs the two encrypted images together, which causes a certain amount of information leakage.
You can invoke the script like this:
python otp_reuse.py <image1-path> <image2-path>
Note: The program relies on the cv2
and numpy
Python packages. If you have the pip
installer for Python, you can install these as follows (you may need to install these using sudo
if you don’t have root
permissions):
pip install opencv-python
pip install numpy