Created
November 14, 2016 07:00
-
-
Save panggi/04d1b117cf2b6e1039b908fabfd2b6b1 to your computer and use it in GitHub Desktop.
Exhaustive Search MD5 Brute Force
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'digest' | |
| LOOKUP_RANGE = 15000000 | |
| target_hashes = [] | |
| target_hash = "" | |
| while target_hash != "stop" | |
| puts "Input target hash: " | |
| target_hash=gets.strip | |
| target_hashes.push target_hash if target_hash != "stop" | |
| end | |
| steps = 0 | |
| target_hashes.each do |target| | |
| start_time = Time.now | |
| steps = steps.to_i + 1 | |
| (1..LOOKUP_RANGE).each do |num| | |
| steps = steps.to_i + 1 | |
| if Digest::MD5.hexdigest(num.to_s) == target | |
| steps = steps.to_i + 1 | |
| end_time = Time.now | |
| puts "Plaintext for #{target}: #{num}" | |
| puts "Time: #{end_time - start_time}" | |
| puts "Steps: #{steps}" | |
| steps = 0 | |
| break | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment