Keyspace location

General discussion of GPU hardware and software
  • Ads

Keyspace location

Postby matt_heys » Tue Aug 25, 2009 3:21 pm

I have a question about how you know what Key to hash?

As I understand it there are Grids & Blocks and something else that you can use to get a thread index, do you convert this thread index then to something like "AAA" = 703 assuming just using Upper-case Alpha?

If so how do you do that? I am thinking it's something to do with Integer and Mod's on numbers and dividing it by 26 until you get between 0 and 1 but I am having difficulties with it so it might not be like that.
matt_heys
 
Posts: 3
Joined: Tue Aug 25, 2009 2:25 pm

Re: Keyspace location

Postby matt_heys » Wed Aug 26, 2009 9:48 am

Ahh got it, wasn't removing the Mod before dividing by the base.

Code: Select all
#include <iostream>
int main(){
    int a = 12345;
    int b;
    do {
        b = a % 26;
        cout << char(64 + b);
        a = (a - b) / 26;
        }  while (a != 0);
    cout << endl;
    system("PAUSE");
    return 0;
}


output would be "UFR"

Is that the best way of doing it? I'm guessing an array of characters would be better then char(64+b), but this was just a test.
matt_heys
 
Posts: 3
Joined: Tue Aug 25, 2009 2:25 pm

Re: Keyspace location

Postby Bitweasil » Wed Aug 26, 2009 10:46 am

Have you looked at the source? It might be a good place to start.

I divide the problem space into (#threads) chunks, and then run through this in short intervals, depending on the -m value (how long to run each kernel), and tune this as I go to handle different card speeds.

For each thread, the starting point is calculated initially from the 64-bit index by the modulo/division on the CPU, and then the thread keeps track of things and iterates through it's given space without using modulo. There is a lookup table for the character set, and for per-position stuff in 0.7, a character set lookup for each position.

I accept that my plaintext generation is less than ideal in some ways, and could probably be improved. However, since the major choke point in my code is the looking up of hashes (after the hash has been generated), and my code speed drops based on the number of hashes, I don't feel the plaintext generation is a *huge* limitation. Speedups in it would certainly help performance with low numbers of hashes, and I could easily optimize if I were running with a fixed character set, but I currently don't think that huge speedups are doable with just changing plaintext generation. Feel free to prove me wrong, though!
Bitweasil
Site Admin
 
Posts: 912
Joined: Tue Jan 20, 2009 4:26 pm

Re: Keyspace location

Postby matt_heys » Wed Aug 26, 2009 12:06 pm

Thanks for the reply, I found some code in the developers forum after posting my last reply, I had previously looked for it on the website and saw a message saying you were delaying releasing until it had been tidied up. ;)

I'm not really trying to improve on your code (wouldn't know where to start), I'm new to C++ and am only learning it to dabble with Cuda, although once I do I imagine I will use it for much more.

My real goal is just to get something like a brute force Key Search running as a real world test for my new skills and yours was the only site that really mentioned source code that I could see. :D

The plain text generation is partly for a distributed approach across multiple machines (split it in to 1-1000, 1001-2000 . . . chunks, well probably a lot bigger than that) it was stumping me how to work out where I was.

If I have any ideas (doubtful) ill post a message.
matt_heys
 
Posts: 3
Joined: Tue Aug 25, 2009 2:25 pm


Return to GPU Acceleration Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron