Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

Brute force MD5 cracker - Ruby Code Bank


Brute force MD5 cracker
Real brute force cracker (check only small letters).
                require 'digest/md5'
def crack(hash, max_length)
  for i in 1..max_length
    for word in ('a'*i..'z'*i)
      if Digest::MD5.new(word) == hash
        return word
      end
    end
  end
end
puts crack(ARGV[0], 5)

            
Comments
ellipsis's avatar
ellipsis 11 years ago

This won't work for passwords with numbers, uppercase, or symbols, but still pretty neat. I like how you give the password length param. It's not bad for an eleven line code.