views:

761

answers:

4

Interesting paper from Trinity College of Dublin:
AES Encryption Implementation and Analysis on Commodity Graphics Processing Units

Their technique uses openGL to enlist the GPU to do the numeric transforms required by AES.

How difficult would it be to expose this capability - performing stream encryption - via a managed .NET library?

How would I get started? Hints? Examples?

EDIT: Anyone have experiences to relate using CUDA or Accelerator?

+2  A: 

I suggest creating a managed wrapper around a CUDA/(c++/cli) implementation OR using cuda.net to do everything but the kernel itself in c#. There is really no way to do the actual kernel implementation in a high-level language, with CUDA you need to use c, with opengl/directx you need to use shaders. To get started either take a look at cuda.net or download the CUDA SDK and examples to get an introduction to gpgpu programming.

Øystein E. Krog
There's already a CUDA.NET wrapper here: http://www.hoopoe-cloud.com/Solutions/CUDA.NET/Default.aspx
Drew Marsh
I did not say to use a wrapper around CUDA, but a wrapper around a CUDA _implementation_. The difference is crucial since if you use cuda.net you end up having to do a lot of stuff that is much easier in c/c++. I also had a lot of trouble with cuda.net, several of the samples do not even work. In addition you will have to do a lot of memory/buffer management in c#, something which is usually easier in c/c++.You will also have to choose between managed memory (no pagelocked memory, thus much lower memory transfer performance) or unmanaged memory (much more overhead if you want to work in c#).
Øystein E. Krog
+3  A: 

You could use Microsoft's Accelerator library. It gives you access to the GPU through .NET.

After looking into the work required more, this is a pretty non-trivial thing to do (unless you like re-writing AES algorithms). It is possible however.

There may be other C# API's out there, but one I came across was Bouncy Castle API. What you would have to do is take Microsoft's Accelerator API and use it anywhere a math operation is performed within the source code of the AES algorithm.

Dan Herbert
sounds like a good possibility. Got any examples?
Cheeso
+2  A: 

Another option is Brahma (the web site seems to be down atm).

Web site Quote:

What is Brahma?

Brahma is an open-source library written for the .NET 3.5 framework (in C# 3.0), to provide high-level access to parallel streaming computations on a variety of processors. Please note at while at this time Brahma has a GPU provider (and its focus is GPGPU), it can be adapted to run on any kind of processor.

What can I do with Brahma?

Brahma 2.0 uses C# 3.0's new LINQ syntax to specify streaming transformation of data. Using Brahma, you can mix statements that run on the GPU and statements that run on the CPU inside a single method! With absolutely no glue code required, a complex multipass GPU computation with intervening CPU operations can be performed with just a few lines of code. All the glue and shader code required is automatically generated by Brahma. All you need to do is write high-level .NET code.

I haven't used it but I just recently listened to a podcast about it on .NET rocks. It sounds like a good library to use if you don't want to get into learning the GPU shader language(s).

Here is the sourceforge link.

Shane Powell
A: 

Whatever you use to integrate C# to the GPU, you should use a CUDA implementation of AES. They are the fastest out there. The fastest implementation looks like it comes from the same guys you linked to - Trinity group. Look at the Practical Symmetric Key Cryptography on Modern Graphics Hardware paper.