SHA1 of long messages - not brute forcer

I’m looking at a file carving application. I’m interested in a chunk of data a few megabytes long, for which I know the SHA1 hash but not necessarily the contents of the chunk itself. I’m searching through a much larger file for this chunk. I have a working CPU implementation (in C#) for this but the process is prohibitively slow.

I attempted to get a GPU based version working using CUDAfy.NET, but it seems I can’t use any .NET libraries for the code that the GPU will ultimately be running, and will need to code SHA1 calculation by hand to get it working.

  1. Given the length of the message to be hashed and the time it’ll take to get this coded manually, is it worthwhile to get this up and running in a GPU implementation? Have two GTX 570s and would happily upgrade if I could get this project to effectively utilize them.

  2. There seems to be a plethora of SHA1 brute-forcers utilizing GPUs…anyone know of one off-hand that I could tweak towards the above purpose rather than building this from scratch? Those I’ve found seem to be built to assume the message will be made of ASCII printable characters (for this, they won’t be) and no straightforward way to force-feed it what to hash. (neither is surprising given their intended purpose, of course)

People doing Bitcoin mining are doing the same thing. The cuda version is upto 50 times faster than single core version. Check the web for cudaminer.

Thanks, confirms it’s at least worthwhile to get a GPU implementation working. Unfortunately bitcoin is based on SHA256, so I’ll still need to write up SHA1 from scratch rather than just tweaking the inputs to a bitcoin miner.

As far as I know, SHA1 is pretty sequential. You could run it on a single CUDA thread only which defeats the purpose of making it faster.

CUDA can only excel if you try to compute many hashes in parallel, which is the case in brute-forcing (like it’s done in Bitcoin, Litecoin mining or password cracking).

Christian