Can I exploit GPU to do AES encryption from .NET? If so, how?

泪湿孤枕 提交于 2019-11-30 09:25:38

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.

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.

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!