--- C:\DOCUME~1\SREGHE~1\IMPOST~1\Temp\models.py-revBASE.svn001.tmp.py	mar nov 25 14:59:58 2008
+++ C:\WORK\libs\djtrunk\django\contrib\auth\models.py	mar nov 25 14:39:26 2008
@@ -7,7 +7,7 @@
 from django.db.models.manager import EmptyManager
 from django.contrib.contenttypes.models import ContentType
 from django.utils.encoding import smart_str
-from django.utils.hashcompat import md5_constructor, sha_constructor
+from django.utils.hashcompat import md5_constructor, sha_constructor, sha256_constructor
 from django.utils.translation import ugettext_lazy as _
 
 UNUSABLE_PASSWORD = '!' # This will never be a valid hash
@@ -34,6 +34,10 @@
         return md5_constructor(salt + raw_password).hexdigest()
     elif algorithm == 'sha1':
         return sha_constructor(salt + raw_password).hexdigest()
+    elif algorithm == 'sha256':
+        from django.conf import settings
+        salt = salt + settings.SECRET_KEY
+        return sha256_constructor(salt + raw_password).hexdigest()
     raise ValueError("Got unknown password algorithm type in password.")
 
 def check_password(raw_password, enc_password):
@@ -42,6 +46,7 @@
     encryption formats behind the scenes.
     """
     algo, salt, hsh = enc_password.split('$')
+    
     return hsh == get_hexdigest(algo, salt, raw_password)
 
 class SiteProfileNotAvailable(Exception):
@@ -165,7 +170,7 @@
 
     def set_password(self, raw_password):
         import random
-        algo = 'sha1'
+        algo = 'sha256'
         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)
