6:47 PM
Hi, my questions are: why do you need "step"? What are you going to do with, for example, every 5th permutation?
Also, can you limit the problem to only finding permutations of a certain length? Or at least split the problem into several iterations, each of which only finds permutations of a certain length?
If the program will be multithreaded, it would be faster to split the problem by blocks instead of by steps. In other words, right now if you have 5 threads, one thread would generate 0..5..10..15..20..25 etc.
But why not split it so the first thread generates 0..1..2..3..4, and the next thread generates 25..26..27..28..29
I'll leave you with this link to a solution I gave to a brute force permutation generating question very similar to yours. By using extra space, I was able to generate permutations very quickly (but only if step=1 and the length is fixed): codereview.stackexchange.com/questions/38474/…
You probably won't believe, but that algorithm you gave me a link to is the one I was starting from with that bruteforce business. If you want to, google "Woodpecker hash bruteforce". That's what I'm working with. Two threads are always faster than one. So, two threads will generate all permutations from range [1-10000] than one thread, right? The same is with three threads. That's why I'm not using blocks of numbers.
The version you'll get when you get to the official site appears to be pretty slow now. Why? Because of that algorithm I asked my question about.
7:21 PM
Ah, OK. I've just checked your code and it's damn fast!! How did you do it??!! My code seems to really suck! My _ EGO_ is feeling just like peace of sh*t now...
So then right away I could send 26*26 strings in a row to the next function that needed to process each string
And then to generate the next 26*26 strings, all I do is increment one character across the entire array of 676 strings:
It's much faster because I am basically doing 676 increments and only check for wraparound (from 'z' to 'a') once, instead of doing it once for each string.
Anyways, you should study the code I wrote and see what it's doing. Then adapt that kind of solution to your own code. Still, I think that the permutation generation should be pretty fast compared to whatever processing you are doing on each string (hashing it?) So even if the improved permutation generation is 100x faster than the old way, I doubt that your program as a whole will get faster by more than a few percentage points. It depends on what you are doing with the string though.
7:36 PM
Well, that's extremely fast! So, your code uses lots of memory, but works faster. My code uses as little memory as possible, so it's pretty slow. The latest improvement I made to my code made it run 60_(!!!) times faster. That was to do with hash comparing. Still, the code I'm currently using (not the one in the question) is _seven times slower.
Sure. So I see that you are doing a brute force dictionary search to find the string that hashes to a particular hash?
It probably wouldn't work though. I just looked up SHA-1 and it uses a 512-bit block size so the entire string would need to fit into that block
7:52 PM
If you have access to a Windows or Mac OS computer, you could download the program I'm developing and see how it works.
Speaking about OpenSSL's implementation, they have
AlgoName_Update()
method that allows to add more data to the AlgoName_CTX
pointer.
8:00 PM
In other words, you have a SHA-1 hash, and you just want to find some block that hashes to the same thing?
Or do you actually have a SHA-1 hash of a small string like a password, and you are trying to dictionary search for that password?
Here are some tests that show that the version that's currently used in my app ("old") is very slow compared to other versions ("j3") is the one I was asking about. Yes, "j2" is faster in that case, but it fails to generate correct permutations if
step
is greater or equal to the alphabet's length.
Wordlist brute-force is also implemented, but the most interesting part for me is generating permutations of letters.
"conv" version was written in C++ and it turns out to be very slow. I think it's because I don't know C++ well enough.
next day → last day (19 days later) »
Transcript for
Jul '1515
Jul19
CR: Converting from decimal to word -…
Converting from decimal to word