International Association for Cryptologic Research

International Association
for Cryptologic Research

Advances in Cryptology – ASIACRYPT 2025

Format-Preserving Compression-Tolerating Authenticated Encryption for Images


README

IE-extension

Contents

  1. Requirements
  2. Usage
  3. Sample run

Requirements

pip requirements

Run pip install -r ./IE-extension-backend/requirements.txt

For completeness, the requirements are:

cryptography==44.0.0
numpy==2.2.1
scipy==1.15.1
pillow==11.1.0
jpeglib==1.0.1
requests-toolbelt==1.0.0
setuptools==80.9.0
open-clip-torch==3.2.0

If you are on a UNIX-like system, you will get a slightly higher quality if you do the following:

  1. Go to IE-extension-backend/jpeg-9f.
  2. Check install.txt to see how to install it for your system. Note that we apply a small modification on the original jpeg-9f library, so we need this local compilation step.

Generally, on Mac, you will need to rename makefile.xc to makefile and jconfig.xc to jconfig, and then run make. On Linux, you will need to run ./configure and then run make, without any renaming.

If you are on Windows or otherwise face trouble successfully compiling jpeg-9f:

The code has an all-Python alternative. Just delete the directory IE-extension-backend/jpeg-9f.

Usage

To encrypt an image, navigate to the parent directory of image_encryption package, e.g. cd IE-extension-backed and run python3 -m image_encryption -o <output_filename> -p <password> <input_filename>.

To set up the decryption environment:
1. Get the server running by navigating to IE-extension-backend and running python3 encryption_server.py. The server needs to be up and running for the decryption to work.
2. Then, import the extension (IE-encryption-frontend) to Chrome. For more instructions on how to import an extension, see https://developer.chrome.com/docs/extensions/get-started/tutorial/hello-world#load-unpacked.
The extension should appear in your list of extensions, e.g.

image.

Then, when you right-click on an image, a context menu item with the extension icon should appear, e.g.

dialogue - Copy.

  1. To use the decryption environment, upload an encrypted image to a website. Then, open the image (so that it has the same original size), right click on it, then choose "Decrypt this image". The page might need to be refreshed if this is the first time the extension is used after being loaded to the browser.

Sample run

  1. Encrypting the image:
    image

Note: this environment uses a virtual environment to install python requirements, but it is optional.

  1. Uploading to Facebook:
    image

  2. Decrypting:
    image

image

  1. Result:
    image