Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify random_salt_generator #22

Merged
merged 1 commit into from Jun 30, 2017
Merged

Simplify random_salt_generator #22

merged 1 commit into from Jun 30, 2017

Conversation

delirious-lettuce
Copy link
Contributor

  • Since int(None) raises a TypeError, we can use a try/except and if it is raised, set salt_length = 8. If something else like int('a') was entered, it will raise a ValueError but, if you want it to default to 8 as well, I could change it to something like:

    try:
        salt_length = int(length)
    except (TypeError, ValueError):
        salt_length = 8
  • Instead of having a separate loop for each character set combination, I used a char_set string variable. It is built at the same time as salt_type to get rid of repeated checks below (if not use_string..., elif use_string is True..., etc).

  • There is no need anymore to create the intermediate list salt to then turn into a string. The salt string is created immediately using whatever character set is in char_set and the salt_length.

These changes make generating salts more efficient.

Copy link
Owner

@Ekultek Ekultek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Speed test it compared to mine please. I'm worried about speed here

@Ekultek Ekultek self-assigned this Jun 29, 2017
@delirious-lettuce
Copy link
Contributor Author

"One of Guido’s key insights is that code is read much more often than it is written."

The speed difference is negligible, only the first test is slower than the original (the second test is essentially tied). These tests are also not checking different lengths (feel free to write those on your own though).

Having simple and maintainable code should be more important. The original version repeats work and is harder to reason about.

  • The bytecode is now only 130 lines, down from 194 (simplified)
  • When you are doing things like calling str(...) for every iteration in a for loop, it's unnecessary. salt.append(str(random.randint(0, 9)))
  • Concatenating strings on every iteration is unnecessary as well. salt.append(random.choice(str(string.digits + string.ascii_letters)))
  • Repeatedly checking whether use_string and use_number are True/False is unnecessary.
In[3]: %timeit original(True, False)
10000 loops, best of 3: 19.2 µs per loop
In[4]: %timeit new_version(True, False)
The slowest run took 5.45 times longer than the fastest. This could mean that an intermediate result is being cached.
10000 loops, best of 3: 25 µs per loop

In[5]: %timeit original(True, True)
10000 loops, best of 3: 24.1 µs per loop
In[6]: %timeit new_version(True, True)
10000 loops, best of 3: 25.1 µs per loop

In[7]: %timeit original(False, True)
The slowest run took 4.19 times longer than the fastest. This could mean that an intermediate result is being cached.
10000 loops, best of 3: 35 µs per loop
In[8]: %timeit new_version(False, True)
10000 loops, best of 3: 25.3 µs per loop

In[9]: %timeit original(False, False)
10000 loops, best of 3: 33.3 µs per loop
In[10]: %timeit new_version(False, False)
The slowest run took 4.24 times longer than the fastest. This could mean that an intermediate result is being cached.
10000 loops, best of 3: 25.5 µs per loop

@Ekultek
Copy link
Owner

Ekultek commented Jun 30, 2017

Your version with ascii letters and numbers:

>>> import subprocess
>>> for _ in range(5):
...     subprocess.call("python dagon.py -c a04cb97201e51d020c7692b1f798a37f932a2727 -R --use-chars --use-int --salt-size=50 --bruteforce -B")
...
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:02:30 INFO] Checking program integrity...

[*] Starting up at 21:02:31..

[21:02:31 WARNING] It is recommended to keep salt length under 12 characters and integers for faster hashing..
[21:02:31 INFO] Using random salt: 'dtYGmd7Ww19a74EqSpuPghYm5O9iQNk4Uuis35NvWRme79hN1D' and random placement: 'back'...
[21:02:31 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:02:31 INFO] Starting bruteforce with SHA1..
[21:02:31 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:02:31 INFO] Starting bruteforce with RIPEMD160..
[21:02:32 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:02:32 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:02:33 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:02:33 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:02:34 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:02:34 INFO] Time elapsed during benchmark test: 2.60800004005 seconds

[*] Shutting down at 21:02:34..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:02:34 INFO] Checking program integrity...

[*] Starting up at 21:02:35..

[21:02:35 WARNING] It is recommended to keep salt length under 12 characters and integers for faster hashing..
[21:02:35 INFO] Using random salt: 'Xm1GztvMmcuGiu8218K1kuUEtLN3Smf8fGG8BBtkkUrA1DozmR' and random placement: 'back'...
[21:02:35 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:02:35 INFO] Starting bruteforce with SHA1..
[21:02:35 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:02:35 INFO] Starting bruteforce with RIPEMD160..
[21:02:35 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:02:35 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:02:36 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:02:36 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:02:37 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:02:37 INFO] Time elapsed during benchmark test: 1.91999983788 seconds

[*] Shutting down at 21:02:37..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:02:37 INFO] Checking program integrity...

[*] Starting up at 21:02:38..

[21:02:38 WARNING] It is recommended to keep salt length under 12 characters and integers for faster hashing..
[21:02:38 INFO] Using random salt: 'VhR85NBlEGLi6wDtu1vX1mjvF5dDtM7d5gRzK7NvGktYERBnO5' and random placement: 'back'...
[21:02:38 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:02:38 INFO] Starting bruteforce with SHA1..
[21:02:38 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:02:38 INFO] Starting bruteforce with RIPEMD160..
[21:02:39 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:02:39 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:02:39 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:02:39 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:02:40 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:02:40 INFO] Time elapsed during benchmark test: 2.03800010681 seconds

[*] Shutting down at 21:02:40..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:02:41 INFO] Checking program integrity...

[*] Starting up at 21:02:41..

[21:02:41 WARNING] It is recommended to keep salt length under 12 characters and integers for faster hashing..
[21:02:41 INFO] Using random salt: 'Uxp6yEp9dnO9pLHAVLKMV0nyGiXBU98mJUYDsiqgyeJ0aYHPoI' and random placement: 'front'...
[21:02:41 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:02:41 INFO] Starting bruteforce with SHA1..
[21:02:41 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:02:41 INFO] Starting bruteforce with RIPEMD160..
[21:02:42 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:02:42 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:02:42 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:02:42 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:02:43 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:02:43 INFO] Time elapsed during benchmark test: 1.95399999619 seconds

[*] Shutting down at 21:02:43..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:02:44 INFO] Checking program integrity...

[*] Starting up at 21:02:44..

[21:02:44 WARNING] It is recommended to keep salt length under 12 characters and integers for faster hashing..
[21:02:44 INFO] Using random salt: 'TooPEb3G19fRdwY4sg5k3Y3gWAP6qMIvjFA6CHR2yK0bUqIapg' and random placement: 'back'...
[21:02:44 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:02:44 INFO] Starting bruteforce with SHA1..
[21:02:45 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:02:45 INFO] Starting bruteforce with RIPEMD160..
[21:02:45 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:02:45 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:02:45 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:02:45 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:02:46 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:02:46 INFO] Time elapsed during benchmark test: 1.95599985123 seconds

[*] Shutting down at 21:02:46..

0
>>>

@Ekultek
Copy link
Owner

Ekultek commented Jun 30, 2017

My version with ascii letters and numbers:

>>> import subprocess
>>> for _ in range(5):
...     subprocess.call("python dagon.py -c a04cb97201e51d020c7692b1f798a37f932a2727 -R --use-chars --use-int --salt-size=50 --bruteforce -B")
...
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:02:32 INFO] Checking program integrity...

[*] Starting up at 21:02:33..

[21:02:33 WARNING] It is recommended to keep salt length under 12 characters and integers for faster hashing..
[21:02:33 INFO] Using random salt: 'kJUvkxns8Rt5GuOHbsN7BdSdz2RKchE3jzTXZUDB6dq0QOrvOA' and random placement: 'front'...
[21:02:33 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:02:33 INFO] Starting bruteforce with SHA1..
[21:02:33 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:02:33 INFO] Starting bruteforce with RIPEMD160..
[21:02:34 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:02:34 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:02:34 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:02:34 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:02:35 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:02:35 INFO] Time elapsed during benchmark test: 2.16999983788 seconds

[*] Shutting down at 21:02:35..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:02:36 INFO] Checking program integrity...

[*] Starting up at 21:02:36..

[21:02:36 WARNING] It is recommended to keep salt length under 12 characters and integers for faster hashing..
[21:02:36 INFO] Using random salt: 'dbcGE87xl9lv5HtTT3bBD3EsZ745SIusrD69OlMMNfWAV3ibXD' and random placement: 'front'...
[21:02:36 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:02:36 INFO] Starting bruteforce with SHA1..
[21:02:37 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:02:37 INFO] Starting bruteforce with RIPEMD160..
[21:02:37 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:02:37 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:02:37 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:02:37 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:02:38 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:02:38 INFO] Time elapsed during benchmark test: 2.2349998951 seconds

[*] Shutting down at 21:02:38..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:02:39 INFO] Checking program integrity...

[*] Starting up at 21:02:40..

[21:02:40 WARNING] It is recommended to keep salt length under 12 characters and integers for faster hashing..
[21:02:40 INFO] Using random salt: 'ky1OJnPGJFxaiu4uUgiPlBBej0L0LoWPyIs6hQSTrQcZaqfJn2' and random placement: 'front'...
[21:02:40 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:02:40 INFO] Starting bruteforce with SHA1..
[21:02:40 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:02:40 INFO] Starting bruteforce with RIPEMD160..
[21:02:40 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:02:40 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:02:41 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:02:41 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:02:42 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:02:42 INFO] Time elapsed during benchmark test: 2.29699993134 seconds

[*] Shutting down at 21:02:42..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:02:43 INFO] Checking program integrity...

[*] Starting up at 21:02:43..

[21:02:43 WARNING] It is recommended to keep salt length under 12 characters and integers for faster hashing..
[21:02:43 INFO] Using random salt: 'gPLE708KbBT5DAGqzlLx6UcEH2pE7ewukHIwz13aBcmeUbnYT4' and random placement: 'back'...
[21:02:43 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:02:43 INFO] Starting bruteforce with SHA1..
[21:02:43 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:02:43 INFO] Starting bruteforce with RIPEMD160..
[21:02:44 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:02:44 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:02:44 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:02:44 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:02:45 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:02:45 INFO] Time elapsed during benchmark test: 2.26699995995 seconds

[*] Shutting down at 21:02:45..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:02:46 INFO] Checking program integrity...

[*] Starting up at 21:02:46..

[21:02:47 WARNING] It is recommended to keep salt length under 12 characters and integers for faster hashing..
[21:02:47 INFO] Using random salt: 'FZAubGNXDKdHHU4dtPZt2lxDcVHELiNMBK4zvf9RtthCEmmORO' and random placement: 'front'...
[21:02:47 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:02:47 INFO] Starting bruteforce with SHA1..
[21:02:47 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:02:47 INFO] Starting bruteforce with RIPEMD160..
[21:02:47 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:02:47 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:02:48 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:02:48 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:02:49 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:02:49 INFO] Time elapsed during benchmark test: 2.39300012589 seconds

[*] Shutting down at 21:02:49..

0
>>>

@Ekultek
Copy link
Owner

Ekultek commented Jun 30, 2017

Your version random bytes:

>>> for _ in range(5):
...     subprocess.call("python dagon.py -c a04cb97201e51d020c7692b1f798a37f932a2727 --urandom 15 --bruteforce -B")
...
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:08:52 INFO] Checking program integrity...

[*] Starting up at 21:08:53..

[21:08:53 INFO] Using urandom salt: '#�OhC¿∞√Aуê▌B�' on the 'front' of the hash...
[21:08:53 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:08:53 INFO] Starting bruteforce with SHA1..
[21:08:54 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:08:54 INFO] Starting bruteforce with RIPEMD160..
[21:08:54 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:08:54 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:08:55 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:08:55 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:08:55 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:08:55 INFO] Time elapsed during benchmark test: 2.11899995804 seconds

[*] Shutting down at 21:08:55..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:08:56 INFO] Checking program integrity...

[*] Starting up at 21:08:57..

[21:08:57 INFO] Using urandom salt: ',�σ3╚'vî╧■¬ 5╪' on the 'back' of the hash...
[21:08:57 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:08:57 INFO] Starting bruteforce with SHA1..
[21:08:57 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:08:57 INFO] Starting bruteforce with RIPEMD160..
[21:08:58 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:08:58 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:08:58 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:08:58 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:08:59 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:08:59 INFO] Time elapsed during benchmark test: 2.30000019073 seconds

[*] Shutting down at 21:08:59..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:09:00 INFO] Checking program integrity...

[*] Starting up at 21:09:01..

[21:09:01 INFO] Using urandom salt: 'G(æ*;5�≥Iô«¥ïgc' on the 'front' of the hash...
[21:09:01 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:09:01 INFO] Starting bruteforce with SHA1..
[21:09:01 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:09:01 INFO] Starting bruteforce with RIPEMD160..
[21:09:01 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:09:01 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:09:02 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:09:02 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:09:03 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:09:03 INFO] Time elapsed during benchmark test: 2.125 seconds

[*] Shutting down at 21:09:03..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:09:04 INFO] Checking program integrity...

[*] Starting up at 21:09:04..

[21:09:04 INFO] Using urandom salt: 'É$|¿╧D°�u*┐+B¡_' on the 'front' of the hash...
[21:09:04 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:09:04 INFO] Starting bruteforce with SHA1..
[21:09:05 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:09:05 INFO] Starting bruteforce with RIPEMD160..
[21:09:05 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:09:05 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:09:06 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:09:06 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:09:06 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:09:06 INFO] Time elapsed during benchmark test: 1.89499998093 seconds

[*] Shutting down at 21:09:06..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:09:08 INFO] Checking program integrity...

[*] Starting up at 21:09:08..

[21:09:08 INFO] Using urandom salt: '3╒_║╔g╤¬J\y`\' on the 'back' of the hash...
[21:09:08 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:09:08 INFO] Starting bruteforce with SHA1..
[21:09:09 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:09:09 INFO] Starting bruteforce with RIPEMD160..
[21:09:09 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:09:09 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:09:09 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:09:09 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:09:10 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:09:10 INFO] Time elapsed during benchmark test: 1.97699999809 seconds

[*] Shutting down at 21:09:10..

0
>>>

@Ekultek
Copy link
Owner

Ekultek commented Jun 30, 2017

My version random bytes:

>>> for _ in range(5):
...     subprocess.call("python dagon.py -c a04cb97201e51d020c7692b1f798a37f932a2727 --urandom 15 --bruteforce -B")
...
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:09:34 INFO] Checking program integrity...

[*] Starting up at 21:09:34..

[21:09:34 INFO] Using urandom salt: ':╟Q���É'D≈╔[τ�' on the 'back' of the hash...
[21:09:34 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:09:34 INFO] Starting bruteforce with SHA1..
[21:09:35 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:09:35 INFO] Starting bruteforce with RIPEMD160..
[21:09:35 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:09:35 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:09:36 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:09:36 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:09:37 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:09:37 INFO] Time elapsed during benchmark test: 2.64499998093 seconds

[*] Shutting down at 21:09:37..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:09:38 INFO] Checking program integrity...

[*] Starting up at 21:09:39..

[21:09:39 INFO] Using urandom salt: '   ┼╕╝╬�φ╙�!ä^0�' on the 'front' of the hash...
[21:09:39 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:09:39 INFO] Starting bruteforce with SHA1..
[21:09:39 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:09:39 INFO] Starting bruteforce with RIPEMD160..
[21:09:40 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:09:40 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:09:40 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:09:40 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:09:41 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:09:41 INFO] Time elapsed during benchmark test: 2.42199993134 seconds

[*] Shutting down at 21:09:41..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:09:42 INFO] Checking program integrity...

[*] Starting up at 21:09:43..

[21:09:43 INFO] Using urandom salt: 'ûO$qU�╚«>ì╘┘1TÉ' on the 'back' of the hash...
[21:09:43 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:09:43 INFO] Starting bruteforce with SHA1..
[21:09:44 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:09:44 INFO] Starting bruteforce with RIPEMD160..
[21:09:44 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:09:44 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:09:45 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:09:45 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:09:46 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:09:46 INFO] Time elapsed during benchmark test: 3.02300000191 seconds

[*] Shutting down at 21:09:46..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:09:47 INFO] Checking program integrity...

[*] Starting up at 21:09:48..

[21:09:48 INFO] Using urandom salt: 'à║ Φe╕{vΘσ╬µá╔┴' on the 'back' of the hash...
[21:09:48 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:09:48 INFO] Starting bruteforce with SHA1..
[21:09:48 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:09:48 INFO] Starting bruteforce with RIPEMD160..
[21:09:49 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:09:49 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:09:49 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:09:49 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:09:51 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:09:51 INFO] Time elapsed during benchmark test: 2.57100009918 seconds

[*] Shutting down at 21:09:51..

0
Dagon .. Advanced Hash Manipulation v1.8.16.26(dev)
Clone: https://github.com/ekultek/dagon.git

[21:09:52 INFO] Checking program integrity...

[*] Starting up at 21:09:52..

[21:09:52 INFO] Using urandom salt: 'Γû╗}╕╔└S╞_�α
╦@' on the 'back' of the hash...
[21:09:52 INFO] Found 4 possible hash types to run against: ('sha1', 'ripemd160', 'sha1(sha1(pass))', 'sha1(sha1(sha1(pass)))')
[21:09:52 INFO] Starting bruteforce with SHA1..
[21:09:52 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1..
[21:09:52 INFO] Starting bruteforce with RIPEMD160..
[21:09:53 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using RIPEMD160..
[21:09:53 INFO] Starting bruteforce with SHA1(SHA1(PASS))..
[21:09:54 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(PASS))..
[21:09:54 INFO] Starting bruteforce with SHA1(SHA1(SHA1(PASS)))..
[21:09:55 WARNING] Unable to find a match for 'a04cb97201e51d020c7692b1f798a37f932a2727', using SHA1(SHA1(SHA1(PASS)))..
[21:09:55 INFO] Time elapsed during benchmark test: 2.66600012779 seconds

[*] Shutting down at 21:09:55..

0
>>>

@delirious-lettuce
Copy link
Contributor Author

Is this a joke? How am I supposed to read 1000+ lines of code hahaha

@Ekultek
Copy link
Owner

Ekultek commented Jun 30, 2017

So as you can see, your version is faster, so this is accepted.

@Ekultek Ekultek merged commit d61018a into Ekultek:master Jun 30, 2017
@delirious-lettuce
Copy link
Contributor Author

Wait one second though

@delirious-lettuce
Copy link
Contributor Author

Did you want me to make that change though (to handle if somehow a string like 'a' is passed as length?

try:
    salt_length = int(length)
except (TypeError, ValueError):
    salt_length = 8

@Ekultek
Copy link
Owner

Ekultek commented Jun 30, 2017

Nah, the error is good, people should know the difference between a number and a letter

@delirious-lettuce
Copy link
Contributor Author

Ok, sounds good. Just wanted to double check!

I'm actually just starting to rewrite the optparse section, maybe by tomorrow I'll have something to show you.

@delirious-lettuce delirious-lettuce deleted the random_salt_generator branch June 30, 2017 02:18
@Ekultek
Copy link
Owner

Ekultek commented Jun 30, 2017 via email

@delirious-lettuce
Copy link
Contributor Author

I'm just doing it for fun and learning. If you like it at the end, great, but I'm really not too worried if you don't. I enjoy trying to figure out how to solve problems. The cli part is a couple hundred line puzzle for me, that's all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants