diff -Nurp Trac-0.11.2.orig/contrib/htdigest.py Trac-0.11.2/contrib/htdigest.py
|
old
|
new
|
import sys |
| 21 | 21 | from optparse import OptionParser |
| 22 | 22 | from getpass import getpass |
| 23 | 23 | |
| 24 | | # The md5 module is deprecated in Python 2.5 |
| | 24 | # The md5 module is deprecated in Python 2.6 |
| 25 | 25 | try: |
| 26 | 26 | from hashlib import md5 |
| 27 | 27 | except ImportError: |
diff -Nurp Trac-0.11.2.orig/trac/util/compat.py Trac-0.11.2/trac/util/compat.py
|
old
|
new
|
except ImportError: |
| 141 | 141 | return newfunc |
| 142 | 142 | |
| 143 | 143 | |
| 144 | | # The md5 module is deprecated in Python 2.5 |
| | 144 | # The md5 module is deprecated in Python 2.6 |
| 145 | 145 | try: |
| 146 | 146 | from hashlib import md5 |
| 147 | 147 | except ImportError: |
| 148 | 148 | from md5 import md5 |
| | 149 | |
| | 150 | # The sha module is deprecated in Python 2.6 |
| | 151 | try: |
| | 152 | from hashlib import sha1 as sha |
| | 153 | except ImportError: |
| | 154 | from sha import sha |
diff -Nurp Trac-0.11.2.orig/trac/util/__init__.py Trac-0.11.2/trac/util/__init__.py
|
old
|
new
|
from itertools import izip |
| 28 | 28 | |
| 29 | 29 | # Imports for backward compatibility |
| 30 | 30 | from trac.core import TracError |
| 31 | | from trac.util.compat import reversed, sorted, tee, md5 |
| | 31 | from trac.util.compat import reversed, sorted, tee, md5, sha |
| 32 | 32 | from trac.util.html import escape, unescape, Markup, Deuglifier |
| 33 | 33 | from trac.util.text import CRLF, to_utf8, to_unicode, shorten_line, \ |
| 34 | 34 | wrap, pretty_size |
| … |
… |
def get_pkginfo(dist): |
| 254 | 254 | # -- crypto utils |
| 255 | 255 | |
| 256 | 256 | def hex_entropy(bytes=32): |
| 257 | | import sha |
| 258 | 257 | import random |
| 259 | | return sha.new(str(random.random())).hexdigest()[:bytes] |
| | 258 | return sha(str(random.random())).hexdigest()[:bytes] |
| 260 | 259 | |
| 261 | 260 | |
| 262 | 261 | # Original license for md5crypt: |