Skip to content

gchaw/wattless

Repository files navigation

PROJECT WATTLESS
================
Gary Chaw (gchaw)
Bain Syrowik (bain-syrowik)

Overview:
Simple gpu-accelerated AES encryption program written in C, cuda and OpenCL. We implemented counter mode.
Code was programmed for and tested on NVidia GTX-480 and GTX-780.
This is an old project for ECE1782(Programming Massively Parallel Multiprocessors and Heterogeneous Systems), at the University of Toronto, Fall 2013.


Git repo:
https://github.com/gchaw/wattless.git


The aes program is used as follows:
./aes -i <input> -k <key> -c <ctr_init> [-o <output>] [-s] [-p] [-m <cpu|cuda|opencl>]
         -i <input>     	input file to encrypt
         -k <key>       	key to use for encryption
         -c <ctr_init>  	initialize counter to value specified in ctr_init file
         -o <output>    	output file (default is <input>.out)
         -s             	input is a ppm file, so do not encrypt/decrypt the header
         -p             	print output (verbose)
         -m             	method (default is cpu)
		 
The minimum input arguments are the input file to be encrypted, the key to use for encryption, and the value used to initialize the counter. 
It is also possible to specify an output file to write to, choose to not encrypt/decrypt the header of PPM image files, print extra output, and select the encryption method (implementation).  Some examples of usage follow:
./aes -i james_watt.ppm -k test.key -c test.ctr
This uses the CPU (default) to encrypt the james_watt.ppm image using the key found in test.key, and the counter found in test.ctr.  
This will produce an output called james_watt.ppm.out where the header is encrypted as well, which means the encrypted data cannot be viewed.

./aes -i james_watt.ppm -o james_watt_cuda_encrypted.ppm -k test.key -c test.ctr -s -m cuda
This uses CUDA to encrypt the james_watt.ppm image using the key found in test.key, and the counter found in test.ctr.  
This will produce an output called james_watt_cuda_encrypted.ppm where the header is not encrypted, meaning the encrypted image data can be viewed.

./aes -i james_watt_ocl_encrypted.ppm -o james_watt_ocl_decrypted.ppm -k test.key -c test.ctr -s -m opencl
This uses OpenCL to decrypt the image james_watt_ocl_encrypted.ppm using the key found in test.key, and the counter found in test.ctr.  
This will produce an output called james_watt_ocl_decrypted.ppm that should be identical to the james_watt.ppm image.  
Note that when using counter mode, nothing special is required for decryption.  


It is also possible to type:
make cpu_run
make opencl_run
make cuda_run
to test each implementation on a small image of James Watt.


The random test files can be generated by running:
./generate_random_test_files.sh


To check that two binary files are identical run:
diff <(xxd file_one) <(xxd file_two)
If this command yeilds no output, the files are identical.


ORIGINS OF PROJECT NAME:
We used a random word generator found online and chose Wattless from the options that popped up.

About

GPU-accelerated AES encryption project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published