Products

Products

AES 256 CUDA Implementation.

This program is based in the source code from the authors below, and is intended to pave half the way towards an efficient CUDA implementation.

Copyright (c) 2007-2009 Ilya O. Levin, http://www.literatecode.com
Other contributors: Hal Finney
(See copyright note below)

A byte-oriented AES-256 implementation

modified by: Joel Rodriguez-Ramirez.
joelrod@versamedium.com
July-10-2011.

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS
ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Download the aes256_cuda.cu source code (37 KBytes) :

In order to compile the program, do as follows: go to:

cd ~/NVIDIA_GPU_Computing_SDK/C/src

of your cuda sdk directory (were the examples are):

mkdir aes256
cd aes256

copy this file (aes256_cuda.cu) and the following
Makefile to that location. ---start Makefile--- EXECUTABLE := aes256_cuda CUFILES := aes256_cuda.cu CCFILES := include ../../common/common.mk ---finish Makefile--- My cuda card (GTS 450) has 4 SM's and 48 processors per SM edit to fit your video GPU (lines 93-94 n program aes256_cuda.cu) #define SM_BLOCKS 4 #define THREADS 48 alternatively for a GeForce 9600 GT #define SM_BLOCKS 8 #define THREADS 8 type:
make
cp ../../bin/linux/release/aes256_cuda .
To encode:
./aes256_cuda input_file output_file passwd.txt enc

To decode:
./aes256_cuda input_file output_file passwd.txt dec

---my password file looks like---
~/NVIDIA_GPU_Computing_SDK/C/src/aes256# more passwd.txt
00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
~/NVIDIA_GPU_Computing_SDK/C/src/aes256#

SOME THOUGHTS: This cuda implementation is far from optimum:
It would encrypt a 1.2 Gigabyte file in 2 minutes and 30 seconds.
Compared to the (assembler) version of openssl aes 256 which takes
about 30 seconds. Most of the time in the cuda implementation
is due to reading/writing to hard disk and from data transfers to/from
GPU. Still, it is an interesting example, enjoy it.



Copyright Versamedium, 2010. All rights reserved.
All trademarks property of their owners.