title: MD5 Python Brute Force Error
body: <p>I have been coding with python for a while now and decided to make an MD5 brute forcer. This is my code here</p>
  
  <pre><code>import hashlib
  import sys
  import os
  import time
  import urllib2
  import urllib
  import re
  import string 
  import random
  from itertools import islice
  
  string = raw_input("HASH TO DECRYPT: ")
  
  size = input("PASSWORD LENGTH: ")
  
  char_list = ("a")
  
  def random_char(size):
      selection = iter(lambda: random.choice(char_list),object())
      while True:
          yield ''.join(islice(selection, size))
  random_gen = random_char(size) 
  
  def encrypt(random_gen):
      algorithim = hashlib.md5()
      algorithim.update(random_gen)
      encrypted=algorithim.hexdigest()
  
  
  
  def dosethestringexisit():
      if encrypt(random_gen) == string :
          print next(random_char)
      else:
          print("pass not found")
  
  print dosethestringexisit()
  </code></pre>
  
  <p>I've had a couple of issues such as this error </p>
  
  <pre><code>  algorithim.update(random_gen)
  TypeError: must be string or buffer, not generator
  </code></pre>
  
  <p>I don't know how to change the random produced string to fit in the algorithm.update().</p>
  
  <p>Note the char list is only "a" because i used md5 a hash of "a" just to test if the code worked.</p>
  
  <p>Also I was wondering how to make a while loop to repeat the code if the random hash does not equal the hash that needs to be decrypted. Many Thanks.</p>