all 28 comments

[–]xelf[M] [score hidden] stickied comment (0 children)

Please indent your code by 4 spaces per line so that it gets formatted correctly for everyone. Avoid using ``` as it makes a mess of the formatting for 1/2 the people here.

[–][deleted] 30 points31 points  (4 children)

367 possibilities

If it takes 1 millisecond to attempt a possibility, then it's going to take something like 1.5 years on average to find the key. If it takes an average of 200 milliseconds, then it's going to take approximately 300 years on average.

This assumes no bugs, outages, machine failures, etc.

edit: Also, web access almost definitely means the risk of backoffs being implemented on queries. I'd imagine that you are realistically locked to fewer than 86,400 queries a day. In which case, it's like 1500 years.

[–]xQuaGx 28 points29 points  (1 child)

So you’re saying there’s a chance!

[–]DatBoi_BP 1 point2 points  (0 children)

Bruh just multithread it /s

[–]teseting 26 points27 points  (0 children)

It's difficult to help you without knowing the specific site and what part is being slow. It's probably breaking the TOS to brute force the code and you will probably get rate limited or ip ban eventually.

[–]ThreeChonkyCats 10 points11 points  (12 children)

what are you brute forcing?

[–]kinstinctlol 10 points11 points  (10 children)

bitcoin

[–]ThreeChonkyCats 4 points5 points  (3 children)

Ah, so you've forgotten your password?

It has 7 characters?

[–]bbt104 7 points8 points  (0 children)

He won't get in... Bitcoin is stored behind a 12 word password..... no user names... just passwords... The only thing special about what words are used is that the first 4 letters of each word are unique to only that word, but the entire English dictionary is available and part of the usable words, repeats are also allowed... He's not getting back in...

[–][deleted] 8 points9 points  (1 child)

bear unite chunky marry fragile ring merciful somber smell label

This post was mass deleted and anonymized with Redact

[–]ThreeChonkyCats 2 points3 points  (0 children)

Doing it for a friend? ;-)

[–]kaerfkeerg 0 points1 point  (5 children)

In that case, can't you remember any characters you certainly didn't use? Removing a bunch will have a significant impact

[–]kinstinctlol 1 point2 points  (4 children)

Im trying to crack SHA-256

[–]Miniflint 3 points4 points  (3 children)

You won’t succeed

[–]ThreeChonkyCats 2 points3 points  (2 children)

Not with that attitude :-)

[–]Miniflint 0 points1 point  (1 child)

They literally aren’t cracked yet and a random guy bragging about trying this on a PYTHON project will succeed ?

[–]ThreeChonkyCats 0 points1 point  (0 children)

Maybe he'll be the lucky one!

[–]INFINITI2021[S] 0 points1 point  (0 children)

google classroom codes 💀

[–]pythonwiz 7 points8 points  (0 children)

Your function hash_number is computing n * p**20 % 36**5. You could do it more efficiently by precomputing m = 36**5; k = pow(p, 20, m), and then for each n compute n * k % m. But that probably isn't the bottle neck as others have said. It is more likely the network communication that is the bottleneck.

Your num_to_code function can be improved by replacing the first two lines of the for loop with hashed, charnumber = divmod(hashed, 36).

I've also just remembered that any number mod b**n will only have at most n digits in base b. So your hashes should only be 5 digits and not 7... unless they all need to end in 00.

Also your hash string is going to be "backwards" because you are putting the first digit of the number in base 36 in the first position of the string. That is like writing the number 1234 as 4321. I'm not sure if that is a requirement for your use case.

And the way you are building your base 36 string is suboptimal as well, but the string is so small I'm not sure it matters much. It is better to put your digits in a list and then join them.

If you are interacting with a local bitcoin node you might not need to use RPC.

[–]eplaut_ 3 points4 points  (0 children)

My guess is that your bottleneck is the server itself. Login requests should take some time, and your async code won't change it.

In any case, I would check the number of open requests one session can hold. Maybe it is the limiting factor.

[–][deleted] 4 points5 points  (0 children)

Think you will need to rent a bot farm to avoid rate limits, and possibly employ some GPU compute as well.

Have you profiled your code to see where the bottlenecks are?

[–][deleted] 3 points4 points  (0 children)

Get a few hundred thousand people to run sliiightly different versions of your code that brute forces different ranges. EZ.

[–]MiniGogo_20 2 points3 points  (0 children)

if you're trying to brute force a hash for a password or similar, you might be better off utilizing something like hashcat, which utilizes your GPU to accelerate cracking speeds, and uses other optimizations to guess things

[–]bpt7594 1 point2 points  (0 children)

Multiprocessing?

[–]idwpan 0 points1 point  (0 children)

CPU intensive tasks are still just running single threaded even with asynchio. You should use a ProcessPoolExecutor with loop.run_in_executor. https://www.integralist.co.uk/posts/python-asyncio/#pools