Fork Join

834 views 18 slides Jul 22, 2011
Slide 1
Slide 1 of 18
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18

About This Presentation

No description available for this slideshow.


Slide Content

Fork/Join framework Rainbow attack example Philip Savkin [email protected] Twitter: philipsavkin

Fork Join Framework Java framework for supporting a style of parallel programming in which problems are solved by (recursively) splitting them into subtasks that are solved in parallel, waiting for them to complete, and then composing results . http://gee.cs.oswego.edu/dl/papers/fj.pdf

Algorithm Result solve(Problem problem ) { if (problem is small) directly solve problem else { split problem into independent parts fork new subtasks to solve each part join all subtasks compose result from subresults } }

Core classes

Differences from ThreadPoolExecutor Suited for recursive tasks and “divide and conquer” algorithms Work stealing

Work Stealing Wait for all threads to complete their tasks Initial state

Work Stealing Wait for all threads to complete their tasks Other threads are idle until the first thread finished

Part II

Practical example Passwords are rarely kept in cleartext nowadays The problem: restore passwords from a list of password hashes with Rainbow attack

Rainbow attack http://en.wikipedia.org/wiki/Rainbow_attack Build a Rainbo w table using the list of possible passwords Lookup passwords in the table

The algorithm Load top 2000 english words Add all case permutations Add numbers 0-9 Results in 6 000 000 combinations Compute hashes Lookup hashes in the table

How ForkJoin can help? CPU intensive tasks Generate the list of all possible passwords Compute hashes

Let’s see some code!

Test results Tested on Amazon EC2 Extra Large instance running 64 bit AMI Linux 15 Gb RAM, 4 processors Rainbow table size: 6 041 508 Input: list of 1000 MD5 hashes Found all 10 passwords

Test results

Bonus slide - Offtopic  Never keep passwords in cleartext ! MD5 is a bad choice Always add “salt” to passwords The right way: use Bcrypt !

More offtopic  The “ pastebin ” experiment http:// pastebin.com/1iL2P0G5 Found one password “a1”

Questions Thank you!