Download presentation
Presentation is loading. Please wait.
Published byAnnabella Singleton Modified over 9 years ago
1
Computer Science 320 Introduction to Hybrid SMP/Clusters
2
Massively Parallel AES Key Search Inputs: –128-bit plain text block –128-bit cipher text block – 256-bit key with N lower-order bits missing –N, the number of missing lower-order key bits Output: The correct key to encode the text Method: try all 2 N possible missing bit strings to find the key that does encrypt the plain text correctly
3
Sequential Version for (int cntr = 0; cntr < maxcount; ++cntr){ // Try key } Tries up to 2 N possible keys
4
SMP Version new ParallelTeam().execute(new ParallelRegion(){ public void run() throws Exception{ execute(0, maxcounter, new IntegerForLoop(){ public void run(){ for (int cntr = first; cntr <= last; ++cntr){ // Try key } }); } }); Splits 2 N possible keys evenly among K threads
5
Cluster Version Range chunk = new Range(0, maxcounter – 1).subrange(size, rank); int lb = chunk.lb(); int ub = chunk.ub(); for (int cntr = lb; cntr <= ub; ++cntr){ // Try key } Splits 2 N possible keys evenly among K nodes
6
Hybrid Version Range chunk = new Range(0, maxcounter – 1).subrange(size, rank); int lb = chunk.lb(); int ub = chunk.ub(); new ParallelTeam().execute(new ParallelRegion(){ public void run() throws Exception{ execute(lb, ub, new IntegerForLoop(){ public void run(){ for (int cntr = first; cntr <= last; ++cntr){ // Try key } }); } }); Splits 2 N possible keys evenly among Kp nodes * Kt threads per node
7
Specify # Nodes and # Threads Range chunk = new Range(0, maxcounter – 1).subrange(size, rank); int lb = chunk.lb(); int ub = chunk.ub(); new ParallelTeam().execute(new ParallelRegion(){ public void run() throws Exception{ execute(lb, ub, new IntegerForLoop(){ public void run(){ for (int cntr = first; cntr <= last; ++cntr){ // Try key } }); } }); $ java –Dpj.port=28000 –Dpj.np=8 -Dpj.nt=8...
8
Improvement: Early Return for (int cntr = first; cntr <= last; ++cntr){ int lsbs = keylsbs | cntr; trialKey[28] = (byte) (lsbs >>> 24); trialKey[29] = (byte) (lsbs >>> 16); trialKey[30] = (byte) (lsbs >>> 8); trialKey[31] = (byte) (lsbs ); cipher.setKey(trialKey); cipher.encrypt(plainText, trialciphertext); if (match(ciphertext, trialciphertext)){ foundKey = new byte[32] System.arraycopy(trialkey, 0, foundkey, 0, 32); }... if (foundKey != null) System.out.println(Hex.toString(foundkey)); Would like to quit this thread, other threads in the same node, and other nodes early, when the correct key is found
9
Improvement: Sizeup for (int cntr = first; cntr <= last; ++cntr){ int lsbs = keylsbs | cntr; trialKey[28] = (byte) (lsbs >>> 24); trialKey[29] = (byte) (lsbs >>> 16); trialKey[30] = (byte) (lsbs >>> 8); trialKey[31] = (byte) (lsbs ); cipher.setKey(trialKey); cipher.encrypt(plainText, trialciphertext); if (match(ciphertext, trialciphertext)){ foundKey = new byte[32] System.arraycopy(trialkey, 0, foundkey, 0, 32); } if (foundKey != null) System.out.println(Hex.toString(foundkey)); Would also like to extend the size of N beyond 30 bits
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.