  
      def set_password(self, raw_password):
          import sha, random
          algo = 'sha1'
          salt = sha.new(str(random.random())).hexdigest()[:5]
          hsh = sha.new(salt + smart_str(raw_password)).hexdigest()
          self.password = '%s$%s$%s' % (algo, salt, hsh)
  
      def check_password(self, raw_password):
          """
          Returns a boolean of whether the raw_password was correct. Handles
 
</s> remove         import sha, random
 </s> add         import random </s> remove     if algo == 'md5':
        import md5
        return hsh == md5.new(smart_str(salt + raw_password)).hexdigest()
    elif algo == 'sha1':
        import sha
        return hsh == sha.new(smart_str(salt + raw_password)).hexdigest()
    elif algo == 'crypt':
        try:
            import crypt
        except ImportError:
            raise ValueError, "Crypt password algorithm not supported in this environment."
        return hsh == crypt.crypt(smart_str(raw_password), smart_str(salt))
    raise ValueError, "Got unknown password algorithm type in password."
 </s> add     return hsh == get_hexdigest(algo, salt, raw_password) </s> remove             import md5
            is_correct = (self.password == md5.new(smart_str(raw_password)).hexdigest())
 </s> add             is_correct = (self.password == get_hexdigest('md5', '', raw_password))
        salt = get_hexdigest(algo, str(random.random()), str(random.random()))[:5]
        hsh = get_hexdigest(algo, salt, raw_password)
  
      def set_password(self, raw_password):
          import sha, random
          algo = 'sha1'
        salt = get_hexdigest(algo, str(random.random()), str(random.random()))[:5]
        hsh = get_hexdigest(algo, salt, raw_password)
        salt = get_hexdigest(algo, str(random.random()), str(random.random()))[:5]
        hsh = get_hexdigest(algo, salt, raw_password)
          self.password = '%s$%s$%s' % (algo, salt, hsh)
  
      def check_password(self, raw_password):
          """
          Returns a boolean of whether the raw_password was correct. Handles
keep keep keep keep replace replace keep keep keep keep keep
 Fixed #3604 -- django.contrib.auth password checking now uses hashlib if it's available. Thanks, Rob Hudson

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6318 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/contrib/auth/models.py