Search code examples
cudacryptographypycuda

AES decryption using CUDA


For a project that I'm working on, I'm supposed to brute force decrypt an AES-encrypted ciphertext given a portion of the key. The remaining keyspace for the ciphertext is 2^40.

I'd like to run the decryption using CUDA (divide the keyspace over the GPU cores), but I can't seem to find a suitable CUDA AES library. I was wondering if there might be ways around this, such as running a C AES library decrypt in a kernel.

Looking at this question suggests that this may not be possible.

Another option - I currently have an implementation in python; would it be feasible to (learn and) use pyCuda to parallelize it, or would I run into the same problem as above using trying to use a python AES library function?

Also any alternative suggestions to achieve what I'm trying to do would be greatly appreciated! Thanks!


Solution

  • If you can't find a library that suits your needs (meaning it has a CUDA implementation of the functionalities you expect), you have to do your own implementation. However, if you have the sources in any other language, and as this problem seems to be pure mathematics, you should be able to write an "equivalent" in any other language. My suggestion is :

    • First write your own C port of the Python implementation you have ("classic" CPU code)
    • Then write an adaptation of this port with C and CUDA C to use one or several GPUs in the computation

    Notice I said "adapt" and not "translate", as it is really different than just switching from a language to another : you will create a project that uses GPUs in a specific kind of job and you have to consider all the differences between CPU and GPU programming. Anyway this might be a little off-topic for SO, as too broad about GPGPU and not enough focused on a specific problem on a source code from your own.