[kismac] [binaervarianz] r96 - in KisMACng: . Sources/Crypto

  • From: svn@xxxxxxxxxxxxxxxx
  • To: kismac@xxxxxxxxxxxxx
  • Date: Thu, 02 Mar 2006 23:23:51 +0100

Author: gkruse
Date: 2006-03-02 23:23:50 +0100 (Thu, 02 Mar 2006)
New Revision: 96

Modified:
   KisMACng/CHANGES
   KisMACng/Sources/Crypto/WaveNetWPACrack.m
   KisMACng/Sources/Crypto/WaveNetWPACrackAltivec.m
Log:

Fix Altivec WPA Wordlist crack on ppc that I broke in R91.
This accelerated wpa crack does not work on intel but I'll leave the code there 
in case anyone wants to investigate further.  
Also added a words / sec status to the wpa crack dialog that I used for 
benchmarking while debigging this problem.


M    Sources/Crypto/WaveNetWPACrack.m
M    Sources/Crypto/WaveNetWPACrackAltivec.m
M    CHANGES


Modified: KisMACng/CHANGES
===================================================================
--- KisMACng/CHANGES    2006-03-02 07:06:36 UTC (rev 95)
+++ KisMACng/CHANGES    2006-03-02 22:23:50 UTC (rev 96)
@@ -1,3 +1,5 @@
+R96: Fix Altivec WPA Wordlist crack on ppc that I broke in R91.  This 
accelerated wpa crack does not work on intel but I'll leave the code there in 
case anyone wants to investigate further.  Also added a words / sec status to 
the wpa crack dialog that I used for benchmarking while debigging this problem.
+
 R95: Hopfully fix the last of the build issues some people are having  
(including growl link issues)
 
 R94: Fixed Active mode on MacBook Pro (Hopfully) please test

Modified: KisMACng/Sources/Crypto/WaveNetWPACrack.m
===================================================================
--- KisMACng/Sources/Crypto/WaveNetWPACrack.m   2006-03-02 07:06:36 UTC (rev 95)
+++ KisMACng/Sources/Crypto/WaveNetWPACrack.m   2006-03-02 22:23:50 UTC (rev 96)
@@ -292,7 +292,8 @@
 
     ssid = [_SSID cString];
     ssidLength = [_SSID cStringLength];
-    
+  
+    float theTime, prevTime = clock() / (float)CLK_TCK;
     while(![im canceled] && !feof(fptr)) {
         fgets(wrd, 90, fptr);
         i = strlen(wrd) - 1;
@@ -301,8 +302,10 @@
         
         words++;
 
-        if (words % 100 == 0) {
-            [im setStatusField:[NSString stringWithFormat:@"%d words tested", 
words]];
+        if (words % 500 == 0) {
+            theTime =clock() / (float)CLK_TCK;
+            [im setStatusField:[NSString stringWithFormat:@"%d words tested    
%.2f/second", words, 500.0 / (theTime - prevTime)]];
+            prevTime = theTime;
         }
 
         if (i < 8 || i > 63) continue; //passwords must be shorter than 63 
signs
@@ -347,7 +350,7 @@
        NSParameterAssert(wordlist);
        
        [wordlist retain];
-       
+
        if ([WaveHelper isAltiVecAvailable]) {
                if ([self crackWPAWithWordlistAltivec:[wordlist 
stringByExpandingTildeInPath] andImportController:[WaveHelper 
importController]]) successful = YES;
        } else {
@@ -358,4 +361,4 @@
     [wordlist release];
        [pool release];
 }
-@end
+@end
\ No newline at end of file

Modified: KisMACng/Sources/Crypto/WaveNetWPACrackAltivec.m
===================================================================
--- KisMACng/Sources/Crypto/WaveNetWPACrackAltivec.m    2006-03-02 07:06:36 UTC 
(rev 95)
+++ KisMACng/Sources/Crypto/WaveNetWPACrackAltivec.m    2006-03-02 22:23:50 UTC 
(rev 96)
@@ -62,28 +62,30 @@
     #define vec_and(a, b) _mm_and_si128(a, b)
     #define vec_xor(a, b) _mm_xor_si128(a, b)
     #define vec_or(a, b)  _mm_or_si128(a, b)
+//this is not right but at least we can compile it!
+    #define vec_rl(a, b)  vL128Rotate(a, b)
 #endif
 
 #define blkA0(i) buf[i].v
 
-#define blkA(i) (buf[i & 15].v = vL128Rotate(vec_xor(buf[(i + 13) & 15].v, 
vec_xor(buf[(i + 8) & 15].v, vec_xor(buf[(i + 2) & 15].v, buf[i & 15].v))), 
one))
+#define blkA(i) (buf[i & 15].v = vec_rl(vec_xor(buf[(i + 13) & 15].v, 
vec_xor(buf[(i + 8) & 15].v, vec_xor(buf[(i + 2) & 15].v, buf[i & 15].v))), 
one))
 
 /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
 #define R0A(v,w,x,y,z,i) \
-       z = vec_add(z, vec_add(vec_xor(vec_and(w, vec_xor(x, y)), y), 
vec_add(blkA0(i), vec_add(const0, vL128Rotate(v, five))))); \
-       w = vL128Rotate(w, thirty);
+       z = vec_add(z, vec_add(vec_xor(vec_and(w, vec_xor(x, y)), y), 
vec_add(blkA0(i), vec_add(const0, vec_rl(v, five))))); \
+       w = vec_rl(w, thirty);
 #define R1A(v,w,x,y,z,i) \
-       z = vec_add(z, vec_add(vec_xor(vec_and(w, vec_xor(x, y)), y), 
vec_add(blkA(i), vec_add(const0, vL128Rotate(v, five))))); \
-       w = vL128Rotate(w, thirty);
+       z = vec_add(z, vec_add(vec_xor(vec_and(w, vec_xor(x, y)), y), 
vec_add(blkA(i), vec_add(const0, vec_rl(v, five))))); \
+       w = vec_rl(w, thirty);
 #define R2A(v,w,x,y,z,i) \
-        z = vec_add(z, vec_add((vec_xor(w, vec_xor(x, y))), vec_add(blkA(i), 
vec_add(const2, vL128Rotate(v, five))))); \
-        w = vL128Rotate(w, thirty);
+        z = vec_add(z, vec_add((vec_xor(w, vec_xor(x, y))), vec_add(blkA(i), 
vec_add(const2, vec_rl(v, five))))); \
+        w = vec_rl(w, thirty);
 #define R3A(v,w,x,y,z,i) \
-       z = vec_add(z, vec_add(vec_or(vec_and(vec_or(w, x), y), vec_and(w, x)), 
vec_add(blkA(i), vec_add(const3, vL128Rotate(v, five))))); \
-       w = vL128Rotate(w, thirty);
+       z = vec_add(z, vec_add(vec_or(vec_and(vec_or(w, x), y), vec_and(w, x)), 
vec_add(blkA(i), vec_add(const3, vec_rl(v, five))))); \
+       w = vec_rl(w, thirty);
 #define R4A(v,w,x,y,z,i) \
-       z = vec_add(z, vec_add((vec_xor(vec_xor(w,x), y)), vec_add(blkA(i), 
vec_add(const4, vL128Rotate(v, five))))); \
-       w = vL128Rotate(w, thirty);
+       z = vec_add(z, vec_add((vec_xor(vec_xor(w,x), y)), vec_add(blkA(i), 
vec_add(const4, vec_rl(v, five))))); \
+       w = vec_rl(w, thirty);
 
 #pragma mark-
 #pragma mark SHA1 functions
@@ -342,6 +344,7 @@
     ssid = [_SSID cString];
     ssidLength = [_SSID cStringLength];
     
+    float theTime, prevTime = clock() / (float)CLK_TCK;
     do {
         k = 0;
         do {
@@ -354,8 +357,10 @@
             
             words++;
 
-            if (words % 100 == 0) {
-                [im setStatusField:[NSString stringWithFormat:@"%d words 
tested", words]];
+            if (words % 500 == 0) {
+                theTime =clock() / (float)CLK_TCK;
+                [im setStatusField:[NSString stringWithFormat:@"%d words 
tested    %.2f/second", words, 500 / (theTime - prevTime)]];
+                prevTime = theTime;
             }
 
             if (i < 8 || i > 63) continue; //passwords must be shorter than 63 
signs
@@ -394,4 +399,4 @@
     return NO;
 }
 
-@end
+@end
\ No newline at end of file


Other related posts:

  • » [kismac] [binaervarianz] r96 - in KisMACng: . Sources/Crypto