The Non-Consentual Image Hashing Front-End
- Go to File --> Open. Then select UI-New-Draft (NOT NC-Hash!!)
- Go to File and open Project Structure
- In Project set up SDK
- For Project compiler output, set it to \out
- Go to Modules and mark src as Sources
- Go to Global Libraries and import all the jar from javafx-sdk-12.0.2\lib
- Right click the javafx-swt you just created and select "Add to Modules" then select UI-New-Draft. If you don't see such option, proceed to the next step
- Clcik Apply then OK.
- Run Main.
Using Paillier AHE and ZKP to turn a secret key PHash cryptosystem into a public key cryptosystem.
This Application has the following dependencies:
- gmp (for libpaillier)
- cimg
- libpaillier
- GraphicsMagick
- If GMP is not already installed on your mac, you can quickly install it with brew. Simply run
brew install gmp
- Cimg can also be installed with brew.
brew install cimg
- libpaillier: Download and extract the
.tar.gz
file under the "Paillier Libary" heading of the libpaillier homepage. The full install instructions are in theINSTALL
file in the root directory of libpaillier; here we present a summary of those instructions.
- Run
./configure
while in the root directory of libpaillier. - Run
make
to compile. - Optional: run
make check
. - Run
make install
to install.
To Compile our application, navigate to the public-phash/src/
directory and run the following two commands:
g++ -o client client.cpp /usr/local/lib/libgmp.a /usr/local/lib/libpaillier.a -O2 -lm -lpthread -I/usr/X11R6/include -L/usr/X11R6/lib -lm -lpthread -lX11 -fpermissive
g++ -o server server.cpp /usr/local/lib/libgmp.a /usr/local/lib/libpaillier.a -O2 -lm -lpthread -I/usr/X11R6/include -L/usr/X11R6/lib -lm -lpthread -lX11 -fpermissive
Note that if libgmp.a
or libpaillier.a
are located anywhere other than the directories specified above, you will have to modify the arguments of the commands to match their locations on your own system.
To finally compile the application, follow these steps:
- In the
demo/
directory, runautoconf
. This should produce a configure script calledconfigure
. - Run
./configure -h | less
to see the configure options. Of particular interest is the location of libpaillier, which for me was not installed system-wide. - Run
./configure [options]
. For me, the sole option was to specify the location of libpaillier:./configure --with-local-libpaillier=/path/to/libpaillier...
. (here I had to use/usr/local/lib
as my path.) - If the above succeeds, you will now have a (hopefully sane) Makefile,
and running
make
will build the demo. The only binary produced is nowdemo/src/scheme2-demo
. - Note that there is also a makefile in the
src/
directory (the one indemo/
basically just calls it atm). Note also that if you only changescheme2WithZKP.cpp
, re-compiling will be very fast, as CImg is no longer recompiled. - If you want to reset everything (getting rid of the autoconf output
and generated makefiles), then run
make distclean
from thedemo/
directory.
Note: if you ever need to find out where apt
has placed the header or library files, just run sudo dpkg -L <package name>
. For example, sudo dpkg -L libgmp-dev
gave me the parameters /usr/include/x86_64-linux-gnu/
and /usr/lib/x86_64-linux-gnu/
that I use later for linking in the compilation step.
-
Intall cimg
sudo apt install cimg-dev
-
install libgmp with
sudo apt install libgmp-dev
-
Install libpaillier: download the library from U Texas Page , navigate to root directory of libpaillier folder, run the libpaillier config script
./configure --with-gmp-include=/usr/include/x86_64-linux-gnu/ --with-gmp-lib=/usr/lib/x86_64-linux-gnu/
. Then runmake
and finallysudo make install
-
Install GraphicsMagick -- another image processing library that is used by another dependency of our project. To install graphics magic, first scroll down to "Download Sites" on this page and download from one of the http mirrrors. Then, unzip the folder you downloaded, and navigate inside said folder; within the root directory of the folder run:
./configure make make install
To finally compile the application, follow these steps:
- In the
demo/
directory, runautoconf
. This should produce a configure script calledconfigure
. - Run
./configure -h | less
to see the configure options. Of particular interest is the location of libpaillier, which for me was not installed system-wide. - Run
./configure [options]
. For me, the sole option was to specify the location of libpaillier:./configure --with-local-libpaillier=/path/to/libpaillier...
. (here I had to use/usr/local/lib
as my path.) - If the above succeeds, you will now have a (hopefully sane) Makefile,
and running
make
will build the demo. The only binary produced is nowdemo/src/scheme2-demo
. - Note that there is also a makefile in the
src/
directory (the one indemo/
basically just calls it atm). Note also that if you only changescheme2WithZKP.cpp
, re-compiling will be very fast, as CImg is no longer recompiled. - If you want to reset everything (getting rid of the autoconf output
and generated makefiles), then run
make distclean
from thedemo/
directory.
g++ -o client client.cpp /usr/local/lib/libpaillier.a -lm -lgmp -lpthread -lX11 -fpermissive
g++ -o server server.cpp /usr/local/lib/libpaillier.a -lm -lgmp -lpthread -lX11 -fpermissive
g++ -o client client.cpp /usr/local/opt/gmp/lib/libgmp.a /usr/local/lib/libpaillier.a -O2 -lm -lpthread -I/usr/X11R6/include -L/usr/X11R6/lib -lm -lpthread -lX11 -fpermissive
g++ -o server server.cpp /usr/local/opt/gmp/lib/libgmp.a /usr/local/lib/libpaillier.a -O2 -lm -lpthread -I/usr/X11R6/include -L/usr/X11R6/lib -lm -lpthread -lX11 -fpermissive
Navigate to the public-phash/src/
in two separate terminal windows. In one, run ./server
and in the other, run ./client
. The server should generate a public and private key, transmit the public key to the the client, at which point the client calculates the hash and send the response back to the server.