diff -Nurp Trac-0.11.2.orig/contrib/htdigest.py Trac-0.11.2/contrib/htdigest.py
--- Trac-0.11.2.orig/contrib/htdigest.py	2008-11-08 19:29:41.000000000 +0100
+++ Trac-0.11.2/contrib/htdigest.py	2008-11-12 23:12:33.000000000 +0100
@@ -21,7 +21,7 @@ import sys
 from optparse import OptionParser
 from getpass import getpass
 
-# The md5 module is deprecated in Python 2.5
+# The md5 module is deprecated in Python 2.6
 try:
     from hashlib import md5
 except ImportError:
diff -Nurp Trac-0.11.2.orig/trac/util/compat.py Trac-0.11.2/trac/util/compat.py
--- Trac-0.11.2.orig/trac/util/compat.py	2008-11-08 19:29:39.000000000 +0100
+++ Trac-0.11.2/trac/util/compat.py	2008-11-12 23:10:00.000000000 +0100
@@ -141,8 +141,14 @@ except ImportError:
         return newfunc
 
 
-# The md5 module is deprecated in Python 2.5
+# The md5 module is deprecated in Python 2.6
 try:
     from hashlib import md5
 except ImportError:
     from md5 import md5
+
+# The sha module is deprecated in Python 2.6
+try:
+    from hashlib import sha1 as sha
+except ImportError:
+    from sha import sha
diff -Nurp Trac-0.11.2.orig/trac/util/__init__.py Trac-0.11.2/trac/util/__init__.py
--- Trac-0.11.2.orig/trac/util/__init__.py	2008-11-08 19:29:39.000000000 +0100
+++ Trac-0.11.2/trac/util/__init__.py	2008-11-12 23:10:59.000000000 +0100
@@ -28,7 +28,7 @@ from itertools import izip
 
 # Imports for backward compatibility
 from trac.core import TracError
-from trac.util.compat import reversed, sorted, tee, md5
+from trac.util.compat import reversed, sorted, tee, md5, sha
 from trac.util.html import escape, unescape, Markup, Deuglifier
 from trac.util.text import CRLF, to_utf8, to_unicode, shorten_line, \
                            wrap, pretty_size
@@ -254,9 +254,8 @@ def get_pkginfo(dist):
 # -- crypto utils
 
 def hex_entropy(bytes=32):
-    import sha
     import random
-    return sha.new(str(random.random())).hexdigest()[:bytes]
+    return sha(str(random.random())).hexdigest()[:bytes]
 
 
 # Original license for md5crypt:

