Lab multi thread
Upcoming SlideShare
Loading in...5
×
 

Lab multi thread

on

  • 248 views

 

Statistics

Views

Total Views
248
Views on SlideShare
248
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Lab multi thread Lab multi thread Presentation Transcript

  • ● An exhaustive search that tries all possible combinations to discover the secret key.
  • ● The resources required for a brute-force attack grow exponentially with increasing key size, not linearly. # of combinatio ns  number of possible values lengthof key
  • Characters # Values Length 2 Length 3 Length 4 Numeric 10 100 1,000 10,000 Alphabet (case insensitive) 26 676 17,576 456,976 Alphabet (case sensitive) 52 2704 140,608 7,311,616 Alphanumeric 62 3884 238,328 14,776,336 Alphanumeric + symbols 92 8464 778,688 71,639,296
  • ● ● Our task is to develop a multi-threaded program that will distribute the work load into multiple threads. Each thread will be assigned to a specific length to break.
  • TIME Thread 1 Thread 2 Length = 1 Length = 2 Length = 3 Length = 4 Length = 5 Length = 6 Length = 7 Length = 8 Length = 9 Length = 10
  • 1. Main Thread will create Thread 1 and Thread 2 2. Main Thread will assign odd-numbered lengths to thread 1, even-numbered to thread 2 3. Main Thread will start Thread 1 and Thread 2 1. Threads 1 and 2 will search from shortest length. 4. Main thread waits for both threads. (use join) 5. Main Ends
  • ● Use the following template as your guide. – The SecretKey class will be your shared object – The BruteForce Class will be your main class – The WorkerThread will try all possible combinations for its assigned key size
  • public class SecretKey { private String key; public SecretKey(String key) { this.key = key; } public boolean verify(String query){ return query.equals(key); } }
  • public class BruteForce { public char characters[] = + ("ABCDEFGHIJKLMNOPQURSTUVWXYZabcdefghijklmnopqurstuvwkyz" """ + "1234567890" + "~!@#$%^&*()_+|`[]{};:,.<>/?'|") .toCharArray(); SecretKey key; public void initializeKey(){ key = new SecretKey("H!ndiM0Alam"); //sample } }
  • public class WorkerThread extends Thread { SecretKey key; int keylengths[]; WorkerThread(key, int[] keylengths){ this.key = key; this.keylengths = keylengths; } public void run(){ for(int i = 0; i< keylengths.length; i++){ if(crack(key,keylengths[i])){ break; } } } public boolean crack(SecretKey key,int length){ //generate all possible keys of length //code here -- use key.verify(); //if key is verified, print key }
  • ● Submit your ME to isubmitmycode@gmail.com with the following details – Subject : CS140 ME: Password – Name, and section ● Specifications – The limit for key size is 4 (alphanumeric+symbols); ● Deadline: Feb 4, 2014