IPB

Welcome Guest ( Log In | Register )

> Speedy CUDA tool to win EngineYard SHA1 contest
SPWorley
post Jul 19 2009, 07:28 AM
Post #1



*******

Group: Members
Posts: 918
Joined: 13-June 08
From: California USA
Member No.: 107,688



Engineyard is a company that deals with Ruby web apps, often with distributed cloud computing.

They announced a contest yesterday, starting on the morning of July 20, and it lasts one day.
The basic idea is they give a 160 bit SHA1 hash value, and you have a limited dictionary and mixing rules to try to make a phrase which hashes as close to that target as possible. An exact match is likely impossible, but you just want to match more bits than anyone else.
The prizes are several new iPhones, and some $2000 of cloud compute credit.

The only practical attack to win is raw brute force... compute trillions of hash candidates and keep the best one.

Gee, I wonder if anyone on this forum knows of an accessible technology which has a lot of horsepower? CUDA to the rescue!

So I decided to spend this Saturday afternoon putting together a CUDA program to attack this exact contest. I could keep it private and try to win the contest myself, but it will be a lot more fun to let everyone use it! And we still have over a day to tweak the code if you want to start hacking.

I'm attaching source and compiled code here for a ready-to-run contest cracker! If you win the contest, the prize is yours to keep! (But please, tell us on the forum!)\
This code is crude but it does power through over 50M hashes per second on a Quadro.. I bet a 285GTX would do 70M.

It's run from command line, so if you have multiple GPUs, you can run one instance on each GPU. (No time for threading niceties!). No time for a pretty GUI.

The technical strategy

If you read the SHA1 algorithm, you'll see that there's an 80 word lookup table. Ideally we'd like to have every thread do a compute, but there's not enough shared memory to make such a table. But luckily, if we look at the algorithm, it's possible to reorder the computation of the table to use just 16 values in a rolling array per thread. At 192 threads per block (for register stall efficiency), that's 192*16*4=12K.. which fits perfectly into our 16K of shared memory.

The strategy is to have the CPU pick some initial words like "tokyo memcached" and then the GPU takes over and powers through 93^5 variations of that phrase by appending 5 characters to the end. (There are 93 printable ASCII characters, and we can append 5 of them.) Each block assigns the first three chars, and inside the block, the threads compute the 93*93 variations.

The host app doesn't do any work after setting up the base string (which takes a millisecond.). The GPU compute takes about 2 minutes to try the 7 billion hashes. After the GPU finishes, the CPU picks a new base string and the GPU is launched again.
To keep the GPU from locking up, the GPU's speed is timed as it does blocks. Each kernel launch does perhaps 400 blocks. If that takes a short time like 10 ms, the number of blocks is increased for the next launch. The goal is to get kernels of about 50ms.. enough to keep your machine responsive, but not so short that you get efficiency losses due to idle SMs.


The contest

This code here is working right now.. it's ready to use in the contest! But hopefully we can tweak it before launch and I invite all hackers to speed it up and find problems before launch.

Even if you're not interested in hacking, you can still enter the contest! And if you win, the prize is yours. This is your chance to show off your 4-board 295GTX monster! I'd like to show how much power our GPUs can harness. Please also let other people know that there's a tool for people to use.. hopefully we can get it easy enough to use for even non-hackers.


I am NOT involved with the contest or company, I just found it via Twitter and thought it would be great to brute force on a GPU.
I see now that Profquail noticed the same contest!

Compiling. running.

Easy! This is windows, but it should work on Linux and Mac. I'm on my laptop now so I haven't had a chance to try Linux or multi-gpu.

To compile, just:
CODE
      nvcc -I "E:\CUDA\common\inc"  gpusha1.cu  e:\cuda\common\lib\cutil32.lib -o gpusha1search.exe


To run, just open a shell and use a command like:
CODE
         gpusha1search.exe -device 0 6cac827bae250971a8b1fb6e2a96676f7a077b60 Cloud Ruby DHH one eight six active record controller data rspec mongrel MySQL postgresSQL tokyo MRI jruby rubinius memcached exception metaprogramming reflection



Attachments in the next post, let me zip them up with a reference to this thread.

Go to the top of the page
 
+Quote Post

Posts in this topic
- SPWorley   Speedy CUDA tool to win EngineYard SHA1 contest   Jul 19 2009, 07:28 AM
- - SPWorley   Here is source and executable for Windows. I...   Jul 19 2009, 07:33 AM
|- - cbuchner1   Hi, I rolled out the 0.15 version to my 4 GPU beh...   Jul 20 2009, 04:58 PM
|- - profquail   QUOTE (cbuchner1 @ Jul 20 2009, 11:58 AM)...   Jul 20 2009, 05:00 PM
||- - cbuchner1   QUOTE (profquail @ Jul 20 2009, 07:00 PM)...   Jul 20 2009, 05:06 PM
|- - SPWorley   QUOTE (cbuchner1 @ Jul 20 2009, 09:58 AM)...   Jul 20 2009, 05:05 PM
- - SPWorley   OK, past midnight here and time for sleep. I'l...   Jul 19 2009, 07:40 AM
- - crmoore   Just found this when googleing for the contest. T...   Jul 19 2009, 02:40 PM
|- - seibert   Here's some benchmarks of version 0.1 on my mi...   Jul 19 2009, 03:26 PM
||- - SPWorley   QUOTE (seibert @ Jul 19 2009, 08:26 AM) (...   Jul 19 2009, 03:58 PM
||- - cbuchner1   Version 0.15 benchmarks at up to 6.9 Mhashes/sec o...   Jul 20 2009, 03:45 PM
||- - cbuchner1   Best score so far: 39 in a ten minute run using th...   Jul 20 2009, 04:17 PM
||- - SPWorley   QUOTE (cbuchner1 @ Jul 20 2009, 09:17 AM)...   Jul 20 2009, 04:21 PM
||- - SPWorley   QUOTE (cbuchner1 @ Jul 20 2009, 09:17 AM)...   Jul 20 2009, 04:22 PM
||- - cbuchner1   QUOTE (SPWorley @ Jul 20 2009, 06:22 PM) ...   Jul 20 2009, 04:25 PM
|- - SPWorley   QUOTE (crmoore @ Jul 19 2009, 07:40 AM) -...   Jul 19 2009, 03:39 PM
|- - empty_knapsack   Well, 73M/sec is pretty low for GTX275. I've g...   Jul 19 2009, 04:26 PM
|- - crmoore   QUOTE (SPWorley @ Jul 19 2009, 11:39 AM) ...   Jul 19 2009, 06:53 PM
- - SPWorley   QUOTE Definitely some peculiar performance results...   Jul 19 2009, 03:46 PM
|- - seibert   QUOTE (SPWorley @ Jul 19 2009, 09:46 AM) ...   Jul 19 2009, 04:16 PM
|- - profquail   QUOTE (SPWorley @ Jul 19 2009, 10:46 AM) ...   Jul 19 2009, 07:16 PM
|- - profquail   Oh, I also wanted to ask you guys...does anyone kn...   Jul 19 2009, 07:41 PM
|- - SPWorley   QUOTE (profquail @ Jul 19 2009, 12:41 PM)...   Jul 19 2009, 07:52 PM
- - profquail   Hey, I'm glad to see that someone else is goin...   Jul 19 2009, 04:31 PM
- - seibert   Hah! OK, found the bug which invalidates some...   Jul 19 2009, 04:34 PM
|- - seibert   Wow, empty_knapsack is right about the loop unroll...   Jul 19 2009, 04:47 PM
|- - SPWorley   QUOTE (seibert @ Jul 19 2009, 09:47 AM) W...   Jul 19 2009, 04:51 PM
- - SPWorley   OK, I've doubled the speed by a small tweak to...   Jul 19 2009, 04:48 PM
- - SPWorley   QUOTE Hah! OK, found the bug which invalidates...   Jul 19 2009, 04:57 PM
- - profquail   I took a quick look at your code...you did a bunch...   Jul 19 2009, 05:08 PM
|- - SPWorley   QUOTE (profquail @ Jul 19 2009, 10:08 AM)...   Jul 19 2009, 05:14 PM
- - SPWorley   OK, updated to version 0.11.   Jul 19 2009, 05:11 PM
|- - seibert   QUOTE (SPWorley @ Jul 19 2009, 11:11 AM) ...   Jul 19 2009, 05:18 PM
- - SPWorley   Added another 5% speed boost by adding a simpler...   Jul 19 2009, 05:28 PM
- - profquail   I made a test dictionary and some random sentences...   Jul 19 2009, 05:55 PM
- - empty_knapsack   I have some doubts about speed calculations in 0.1...   Jul 19 2009, 06:05 PM
|- - SPWorley   QUOTE (empty_knapsack @ Jul 19 2009, 11:0...   Jul 19 2009, 06:07 PM
- - seibert   I did a little poking around, and sadly, there are...   Jul 19 2009, 06:14 PM
- - SPWorley   Version 12 posted. This now works with the full 1...   Jul 19 2009, 07:56 PM
|- - seibert   QUOTE (SPWorley @ Jul 19 2009, 01:56 PM) ...   Jul 19 2009, 08:32 PM
|- - crmoore   QUOTE (SPWorley @ Jul 19 2009, 03:56 PM) ...   Jul 19 2009, 09:39 PM
|- - SPWorley   QUOTE (crmoore @ Jul 19 2009, 02:39 PM) T...   Jul 19 2009, 09:45 PM
|- - seibert   QUOTE (SPWorley @ Jul 19 2009, 03:45 PM) ...   Jul 19 2009, 10:22 PM
|- - SPWorley   QUOTE (seibert @ Jul 19 2009, 03:22 PM) T...   Jul 19 2009, 10:25 PM
|- - crmoore   QUOTE (seibert @ Jul 19 2009, 06:22 PM) T...   Jul 19 2009, 10:30 PM
- - SPWorley   Ok, now with a working tool, we have questions abo...   Jul 19 2009, 08:50 PM
|- - nkurz   QUOTE (SPWorley @ Jul 19 2009, 01:50 PM) ...   Jul 20 2009, 10:28 AM
- - SPWorley   What do we think the best host strategy might be t...   Jul 19 2009, 09:21 PM
- - profquail   Well, since I don't know if I'll get my pr...   Jul 19 2009, 09:27 PM
- - SPWorley   prof, thanks for the code! I see you really tr...   Jul 19 2009, 09:43 PM
|- - profquail   QUOTE (SPWorley @ Jul 19 2009, 04:43 PM) ...   Jul 19 2009, 09:47 PM
|- - SPWorley   QUOTE (profquail @ Jul 19 2009, 02:47 PM)...   Jul 19 2009, 09:51 PM
|- - profquail   QUOTE (SPWorley @ Jul 19 2009, 04:51 PM) ...   Jul 19 2009, 10:23 PM
|- - SPWorley   QUOTE (profquail @ Jul 19 2009, 03:23 PM)...   Jul 20 2009, 03:19 AM
- - SPWorley   I messed with the score compute and a few other pl...   Jul 19 2009, 10:38 PM
|- - seibert   QUOTE (SPWorley @ Jul 19 2009, 04:38 PM) ...   Jul 19 2009, 10:57 PM
|- - SPWorley   QUOTE (seibert @ Jul 19 2009, 03:57 PM) Y...   Jul 19 2009, 11:10 PM
- - profquail   Here's a second (but still non-working) versio...   Jul 19 2009, 11:17 PM
|- - crmoore   QUOTE (profquail @ Jul 19 2009, 07:17 PM)...   Jul 19 2009, 11:34 PM
|- - profquail   Thanks crmoore, that fixed it. I've got it com...   Jul 19 2009, 11:39 PM
- - SPWorley   Version 0.13 posted. Nothing special, just a place...   Jul 19 2009, 11:28 PM
- - SPWorley   Ok, after some annoying coding, I have asynchronou...   Jul 20 2009, 12:16 AM
- - joevennix   For whatever reason, the tool just isn't worki...   Jul 20 2009, 12:45 AM
|- - SPWorley   QUOTE (joevennix @ Jul 19 2009, 05:45 PM)...   Jul 20 2009, 12:59 AM
|- - profquail   QUOTE (joevennix @ Jul 19 2009, 07:45 PM)...   Jul 20 2009, 01:02 AM
- - joevennix   SPWorley, looks like that did the trick! I was...   Jul 20 2009, 01:12 AM
|- - seibert   QUOTE (joevennix @ Jul 19 2009, 07:12 PM)...   Jul 20 2009, 01:14 AM
- - seibert   This afternoon, I did some plotting of the distrib...   Jul 20 2009, 01:12 AM
|- - profquail   QUOTE (seibert @ Jul 19 2009, 08:12 PM) T...   Jul 20 2009, 01:22 AM
|- - seibert   QUOTE (profquail @ Jul 19 2009, 07:22 PM)...   Jul 20 2009, 01:51 AM
|- - seibert   QUOTE (seibert @ Jul 19 2009, 07:51 PM) A...   Jul 20 2009, 02:17 AM
- - profquail   Just curious...I applied __popc() to my distance c...   Jul 20 2009, 02:25 AM
- - SPWorley   Version 0.14 posted! Minor tweaks, I did not ...   Jul 20 2009, 03:10 AM
- - SPWorley   Some experiments on a G280GTX and using CUDA 2.0 a...   Jul 20 2009, 08:00 AM
|- - crmoore   QUOTE (SPWorley @ Jul 20 2009, 04:00 AM) ...   Jul 20 2009, 11:50 AM
- - nkurz   Thanks for the code to play with! Once I upda...   Jul 20 2009, 08:15 AM
- - profquail   I tried compiling SPWorley's code on Vista x64...   Jul 20 2009, 01:49 PM
- - lvmisooners   I'm also trying to compile 64bit (winXP), and ...   Jul 20 2009, 03:26 PM
|- - SPWorley   QUOTE (lvmisooners @ Jul 20 2009, 08:26 A...   Jul 20 2009, 03:46 PM
|- - profquail   QUOTE (SPWorley @ Jul 20 2009, 10:46 AM) ...   Jul 20 2009, 03:55 PM
|- - lvmisooners   QUOTE (SPWorley @ Jul 20 2009, 10:46 AM) ...   Jul 20 2009, 04:03 PM
- - SPWorley   I need help, everyone.. IF you've compiled an...   Jul 20 2009, 03:52 PM
|- - kashif   QUOTE (SPWorley @ Jul 20 2009, 05:52 PM) ...   Jul 20 2009, 05:06 PM
- - SPWorley   lv, prof, Sorry I don't have a 64 bit Windows...   Jul 20 2009, 04:10 PM
- - SPWorley   BTW, there should be no particular benefit from ma...   Jul 20 2009, 04:18 PM
- - SPWorley   If you try the Sleep() hack, change the minimum bl...   Jul 20 2009, 05:22 PM
|- - cbuchner1   Here is a reasonable millisecond sleep function fo...   Jul 20 2009, 05:35 PM
- - SPWorley   Some contest prep notes: When the contest launche...   Jul 20 2009, 05:27 PM
- - SPWorley   A quick hack might also be to hardwire the block c...   Jul 20 2009, 05:35 PM
- - SPWorley   OK, version 0.16 uploaded. Fixes a leaked timer ha...   Jul 20 2009, 06:03 PM
|- - cbuchner1   It wouldn't be me if I didn't recommend th...   Jul 20 2009, 06:18 PM
|- - SPWorley   QUOTE (cbuchner1 @ Jul 20 2009, 11:18 AM)...   Jul 20 2009, 06:22 PM
|- - SPWorley   QUOTE (cbuchner1 @ Jul 20 2009, 11:18 AM)...   Jul 20 2009, 06:25 PM
- - profquail   Got a couple of minutes until the contest starts, ...   Jul 20 2009, 06:59 PM
|- - cbuchner1   QUOTE (profquail @ Jul 20 2009, 08:59 PM)...   Jul 20 2009, 07:24 PM
|- - profquail   QUOTE (cbuchner1 @ Jul 20 2009, 02:24 PM)...   Jul 20 2009, 07:31 PM
- - profquail   The phrase and dictionary are posted: http://www....   Jul 20 2009, 07:05 PM
|- - cbuchner1   QUOTE (profquail @ Jul 20 2009, 09:05 PM)...   Jul 20 2009, 07:12 PM
|- - profquail   QUOTE (cbuchner1 @ Jul 20 2009, 02:12 PM)...   Jul 20 2009, 07:18 PM
- - SPWorley   Cranking away here on 4 different machines. Too ba...   Jul 20 2009, 07:28 PM
3 Pages V   1 2 3 >


Reply to this topicStart new topic

 



Copyright 2008 NVIDIA Corporation.  Terms of Use | Legal Info | Privacy Policy Time is now: 9th February 2010 - 10:53 PM
Unites States Argentina Brazil Chile China Colombia France Germany India Italy Japan Korea Mexico Poland Russia Spain Taiwan United Kingdom Venezuela